mirror of https://github.com/CGAL/cgal
Remove the scaler form the scene API
This commit is contained in:
parent
812d082883
commit
af7e1a8829
|
|
@ -1738,7 +1738,7 @@ void Scene::updatePrimitiveIds(CGAL::Three::Scene_item* it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool Scene::testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface* viewer, const QVector3D& scaler)
|
bool Scene::testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface* viewer)
|
||||||
{
|
{
|
||||||
CGAL::Three::Scene_item *i = item(mainSelectionIndex());
|
CGAL::Three::Scene_item *i = item(mainSelectionIndex());
|
||||||
if(!i)
|
if(!i)
|
||||||
|
|
@ -1746,7 +1746,7 @@ bool Scene::testDisplayId(double x, double y, double z, CGAL::Three::Viewer_inte
|
||||||
Scene_print_item_interface* spit= qobject_cast<Scene_print_item_interface*>(i);
|
Scene_print_item_interface* spit= qobject_cast<Scene_print_item_interface*>(i);
|
||||||
if(spit && i->visible())
|
if(spit && i->visible())
|
||||||
{
|
{
|
||||||
bool res = spit->testDisplayId(x,y,z, viewer, scaler);
|
bool res = spit->testDisplayId(x,y,z, viewer);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ public:
|
||||||
void printAllIds() Q_DECL_OVERRIDE;
|
void printAllIds() Q_DECL_OVERRIDE;
|
||||||
//!Re-computes the primitiveIds for `item`
|
//!Re-computes the primitiveIds for `item`
|
||||||
void updatePrimitiveIds(Scene_item *item) Q_DECL_OVERRIDE;
|
void updatePrimitiveIds(Scene_item *item) Q_DECL_OVERRIDE;
|
||||||
bool testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface* viewer, const QVector3D& scaler) Q_DECL_OVERRIDE;
|
bool testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface* viewer) Q_DECL_OVERRIDE;
|
||||||
Bbox bbox() const Q_DECL_OVERRIDE;
|
Bbox bbox() const Q_DECL_OVERRIDE;
|
||||||
void computeBbox();
|
void computeBbox();
|
||||||
double len_diagonal() const Q_DECL_OVERRIDE
|
double len_diagonal() const Q_DECL_OVERRIDE
|
||||||
|
|
|
||||||
|
|
@ -2254,9 +2254,9 @@ void Scene_polyhedron_selection_item::printAllIds()
|
||||||
{
|
{
|
||||||
d->item->polyhedron_item()->printAllIds();
|
d->item->polyhedron_item()->printAllIds();
|
||||||
}
|
}
|
||||||
bool Scene_polyhedron_selection_item::testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface* viewer, const QVector3D& scaler)const
|
bool Scene_polyhedron_selection_item::testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface* viewer)const
|
||||||
{
|
{
|
||||||
return d->item->polyhedron_item()->testDisplayId(x, y, z, viewer, scaler);
|
return d->item->polyhedron_item()->testDisplayId(x, y, z, viewer);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2130,7 +2130,7 @@ void Scene_surface_mesh_item::printAllIds()
|
||||||
d->killIds();
|
d->killIds();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Scene_surface_mesh_item::testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface* viewer, const QVector3D& scaler)const
|
bool Scene_surface_mesh_item::testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface* viewer)const
|
||||||
{
|
{
|
||||||
const CGAL::qglviewer::Vec offset = static_cast<CGAL::Three::Viewer_interface*>(CGAL::QGLViewer::QGLViewerPool().first())->offset();
|
const CGAL::qglviewer::Vec offset = static_cast<CGAL::Three::Viewer_interface*>(CGAL::QGLViewer::QGLViewerPool().first())->offset();
|
||||||
EPICK::Point_3 src(x - offset.x,
|
EPICK::Point_3 src(x - offset.x,
|
||||||
|
|
@ -2138,6 +2138,7 @@ bool Scene_surface_mesh_item::testDisplayId(double x, double y, double z, CGAL::
|
||||||
z - offset.z);
|
z - offset.z);
|
||||||
|
|
||||||
CGAL::qglviewer::Camera* cam = viewer->camera();
|
CGAL::qglviewer::Camera* cam = viewer->camera();
|
||||||
|
const QVector3D& scaler = viewer->scaler();
|
||||||
EPICK::Point_3 dest( cam->position().x/scaler.x() - offset.x,
|
EPICK::Point_3 dest( cam->position().x/scaler.x() - offset.x,
|
||||||
cam->position().y/scaler.y() - offset.y,
|
cam->position().y/scaler.y() - offset.y,
|
||||||
cam->position().z/scaler.z() - offset.z);
|
cam->position().z/scaler.z() - offset.z);
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ public:
|
||||||
bool printFaceIds()const Q_DECL_OVERRIDE;
|
bool printFaceIds()const Q_DECL_OVERRIDE;
|
||||||
void printAllIds() Q_DECL_OVERRIDE;
|
void printAllIds() Q_DECL_OVERRIDE;
|
||||||
bool shouldDisplayIds(CGAL::Three::Scene_item *current_item) const Q_DECL_OVERRIDE;
|
bool shouldDisplayIds(CGAL::Three::Scene_item *current_item) const Q_DECL_OVERRIDE;
|
||||||
bool testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface*, const QVector3D &scaler)const Q_DECL_OVERRIDE;
|
bool testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface*)const Q_DECL_OVERRIDE;
|
||||||
float alpha() const Q_DECL_OVERRIDE;
|
float alpha() const Q_DECL_OVERRIDE;
|
||||||
void setAlpha(int alpha) Q_DECL_OVERRIDE;
|
void setAlpha(int alpha) Q_DECL_OVERRIDE;
|
||||||
QSlider* alphaSlider();
|
QSlider* alphaSlider();
|
||||||
|
|
|
||||||
|
|
@ -1483,7 +1483,7 @@ void Viewer::wheelEvent(QWheelEvent* e)
|
||||||
|
|
||||||
bool Viewer::testDisplayId(double x, double y, double z)
|
bool Viewer::testDisplayId(double x, double y, double z)
|
||||||
{
|
{
|
||||||
return d->scene->testDisplayId(x,y,z,this, d->scaler);
|
return d->scene->testDisplayId(x,y,z,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPainter* Viewer::getPainter(){return d->painter;}
|
QPainter* Viewer::getPainter(){return d->painter;}
|
||||||
|
|
@ -2116,4 +2116,6 @@ void Viewer::onTextMessageSocketReceived(QString message)
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const QVector3D& Viewer::scaler()const { return d->scaler; }
|
||||||
#include "Viewer.moc"
|
#include "Viewer.moc"
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,7 @@ public:
|
||||||
//!Set total number of depth peeling passes.
|
//!Set total number of depth peeling passes.
|
||||||
void setTotalPass(int);
|
void setTotalPass(int);
|
||||||
void resetFov();
|
void resetFov();
|
||||||
|
const QVector3D& scaler() const;
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void sendMessage(QString);
|
void sendMessage(QString);
|
||||||
void doneInitGL(CGAL::Three::Viewer_interface*);
|
void doneInitGL(CGAL::Three::Viewer_interface*);
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,8 @@ public:
|
||||||
* \param y the Y coordinate of theTextItem's position.
|
* \param y the Y coordinate of theTextItem's position.
|
||||||
* \param z the Z coordinate of theTextItem's position.
|
* \param z the Z coordinate of theTextItem's position.
|
||||||
* \param viewer the viewer used to display the Scene.
|
* \param viewer the viewer used to display the Scene.
|
||||||
* \param scaler a vector indicating the scaling factors to apply to the scene when displaying it.
|
|
||||||
* It can be useful when a scene is very large along one of it's coordinates, making it hard to visualize it.
|
|
||||||
* \return true if the TextItem is visible. */
|
* \return true if the TextItem is visible. */
|
||||||
virtual bool testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface* viewer, const QVector3D& scaler) = 0;
|
virtual bool testDisplayId(double x, double y, double z, CGAL::Three::Viewer_interface* viewer) = 0;
|
||||||
|
|
||||||
///\brief displays all the vertices ids if there are less than max_textItems.
|
///\brief displays all the vertices ids if there are less than max_textItems.
|
||||||
virtual void printVertexIds() = 0;
|
virtual void printVertexIds() = 0;
|
||||||
|
|
@ -74,7 +72,7 @@ public:
|
||||||
///\brief displays all the primitive ids if there are less than max_textItems.
|
///\brief displays all the primitive ids if there are less than max_textItems.
|
||||||
virtual void printAllIds() = 0;
|
virtual void printAllIds() = 0;
|
||||||
|
|
||||||
//!\brief moves the camera orthogonally to the picked sface.
|
//!\brief moves the camera orthogonally to the picked face.
|
||||||
//!
|
//!
|
||||||
//! \param point the picked point
|
//! \param point the picked point
|
||||||
//! \param viewer the active viewer
|
//! \param viewer the active viewer
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ public:
|
||||||
//!
|
//!
|
||||||
//! \returns true if the Id should be displayed
|
//! \returns true if the Id should be displayed
|
||||||
//! \returns false if the Id should not be displayed (if it is hidden for example)
|
//! \returns false if the Id should not be displayed (if it is hidden for example)
|
||||||
virtual bool testDisplayId(double, double, double, CGAL::Three::Viewer_interface*, const QVector3D& scaler)const = 0;
|
virtual bool testDisplayId(double, double, double, CGAL::Three::Viewer_interface*)const = 0;
|
||||||
|
|
||||||
//! \brief Tests if this item should display its ids.
|
//! \brief Tests if this item should display its ids.
|
||||||
//!
|
//!
|
||||||
|
|
|
||||||
|
|
@ -284,6 +284,9 @@ public:
|
||||||
virtual void makeCurrent() = 0;
|
virtual void makeCurrent() = 0;
|
||||||
virtual QVector4D* clipBox() const =0;
|
virtual QVector4D* clipBox() const =0;
|
||||||
virtual bool isClipping() const = 0;
|
virtual bool isClipping() const = 0;
|
||||||
|
//! A vector indicating the scaling factors to apply to the scene when displaying it.
|
||||||
|
//! It can be useful when a scene is very large along one of it's coordinates, making it hard to visualize it.
|
||||||
|
virtual const QVector3D& scaler() const = 0;
|
||||||
}; // end class Viewer_interface
|
}; // end class Viewer_interface
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue