mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
Allows individual selection of a vertex to be shown on screen.
This commit is contained in:
@@ -54,7 +54,14 @@ void DestinationGLCanvas::doDraw(QPainter* painter)
|
||||
getCurrentShape() != NULL)
|
||||
{
|
||||
painter->save();
|
||||
getMainWindow()->getMapperByMappingId(getMainWindow()->getCurrentMappingId())->drawControls(painter);
|
||||
const Mapper::ptr& mapper = getMainWindow()->getMapperByMappingId(getMainWindow()->getCurrentMappingId());
|
||||
if (hasActiveVertex()) {
|
||||
QList<int> selectedVertices;
|
||||
selectedVertices.append(getActiveVertexIndex());
|
||||
mapper->drawControls(painter, &selectedVertices);
|
||||
}
|
||||
else
|
||||
mapper->drawControls(painter);
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ const QColor MM::DARK_GRAY("#272a36");
|
||||
|
||||
const QColor MM::CONTROL_COLOR(WHITE);
|
||||
const QBrush MM::VERTEX_BACKGROUND(QColor(CONTROL_COLOR.red(), CONTROL_COLOR.green(), CONTROL_COLOR.blue(), 63));
|
||||
const QBrush MM::VERTEX_SELECTED_BACKGROUND(QColor(CONTROL_COLOR.red(), CONTROL_COLOR.green(), CONTROL_COLOR.blue(), 127));
|
||||
const QPen MM::SHAPE_STROKE(QBrush(CONTROL_COLOR), SHAPE_STROKE_WIDTH);
|
||||
const QPen MM::SHAPE_INNER_STROKE(QBrush(CONTROL_COLOR), SHAPE_INNER_STROKE_WIDTH);
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ public:
|
||||
|
||||
static const QColor CONTROL_COLOR;
|
||||
static const QBrush VERTEX_BACKGROUND;
|
||||
static const QBrush VERTEX_SELECTED_BACKGROUND;
|
||||
|
||||
static const qreal SHAPE_STROKE_WIDTH = 2;
|
||||
static const qreal SHAPE_INNER_STROKE_WIDTH = 0.5;
|
||||
|
||||
+18
-18
@@ -136,10 +136,10 @@ void PolygonColorMapper::draw(QPainter* painter)
|
||||
painter->drawPolygon(poly->toPolygon());
|
||||
}
|
||||
|
||||
void PolygonColorMapper::drawControls(QPainter* painter)
|
||||
void PolygonColorMapper::drawControls(QPainter* painter, const QList<int>* selectedVertices)
|
||||
{
|
||||
Polygon* poly = (Polygon*)_mapping->getShape().get();
|
||||
Util::drawControlsPolygon(painter, *poly);
|
||||
Util::drawControlsPolygon(painter, selectedVertices, *poly);
|
||||
}
|
||||
|
||||
MeshColorMapper::MeshColorMapper(Mapping::ptr mapping)
|
||||
@@ -168,10 +168,10 @@ void MeshColorMapper::draw(QPainter* painter)
|
||||
}
|
||||
}
|
||||
|
||||
void MeshColorMapper::drawControls(QPainter* painter)
|
||||
void MeshColorMapper::drawControls(QPainter* painter, const QList<int>* selectedVertices)
|
||||
{
|
||||
std::tr1::shared_ptr<Mesh> outputMesh = std::tr1::static_pointer_cast<Mesh>(outputShape);
|
||||
Util::drawControlsMesh(painter, *outputMesh);
|
||||
Util::drawControlsMesh(painter, selectedVertices, *outputMesh);
|
||||
}
|
||||
|
||||
void MeshColorMapper::setValue(QtProperty* property, const QVariant& value)
|
||||
@@ -215,10 +215,10 @@ void EllipseColorMapper::draw(QPainter* painter)
|
||||
painter->restore(); // restore saved painter state
|
||||
}
|
||||
|
||||
void EllipseColorMapper::drawControls(QPainter* painter)
|
||||
void EllipseColorMapper::drawControls(QPainter* painter, const QList<int>* selectedVertices)
|
||||
{
|
||||
std::tr1::shared_ptr<Ellipse> outputEllipse = std::tr1::static_pointer_cast<Ellipse>(outputShape);
|
||||
Util::drawControlsEllipse(painter, *outputEllipse);
|
||||
Util::drawControlsEllipse(painter, selectedVertices, *outputEllipse);
|
||||
}
|
||||
|
||||
|
||||
@@ -348,16 +348,16 @@ void TextureMapper::_postDraw(QPainter* painter)
|
||||
painter->endNativePainting();
|
||||
}
|
||||
|
||||
void PolygonTextureMapper::drawControls(QPainter* painter)
|
||||
void PolygonTextureMapper::drawControls(QPainter* painter, const QList<int>* selectedVertices)
|
||||
{
|
||||
std::tr1::shared_ptr<Polygon> outputPoly = std::tr1::static_pointer_cast<Polygon>(outputShape);
|
||||
Util::drawControlsPolygon(painter, *outputPoly);
|
||||
Util::drawControlsPolygon(painter, selectedVertices, *outputPoly);
|
||||
}
|
||||
|
||||
void PolygonTextureMapper::drawInputControls(QPainter* painter)
|
||||
void PolygonTextureMapper::drawInputControls(QPainter* painter, const QList<int>* selectedVertices)
|
||||
{
|
||||
std::tr1::shared_ptr<Polygon> inputPoly = std::tr1::static_pointer_cast<Polygon>(inputShape);
|
||||
Util::drawControlsPolygon(painter, *inputPoly);
|
||||
Util::drawControlsPolygon(painter, selectedVertices, *inputPoly);
|
||||
}
|
||||
|
||||
TriangleTextureMapper::TriangleTextureMapper(std::tr1::shared_ptr<TextureMapping> mapping)
|
||||
@@ -411,16 +411,16 @@ void MeshTextureMapper::setValue(QtProperty* property, const QVariant& value)
|
||||
TextureMapper::setValue(property, value);
|
||||
}
|
||||
|
||||
void MeshTextureMapper::drawControls(QPainter* painter)
|
||||
void MeshTextureMapper::drawControls(QPainter* painter, const QList<int>* selectedVertices)
|
||||
{
|
||||
std::tr1::shared_ptr<Mesh> outputMesh = std::tr1::static_pointer_cast<Mesh>(outputShape);
|
||||
Util::drawControlsMesh(painter, *outputMesh);
|
||||
Util::drawControlsMesh(painter, selectedVertices, *outputMesh);
|
||||
}
|
||||
|
||||
void MeshTextureMapper::drawInputControls(QPainter* painter)
|
||||
void MeshTextureMapper::drawInputControls(QPainter* painter, const QList<int>* selectedVertices)
|
||||
{
|
||||
std::tr1::shared_ptr<Mesh> inputMesh = std::tr1::static_pointer_cast<Mesh>(inputShape);
|
||||
Util::drawControlsMesh(painter, *inputMesh);
|
||||
Util::drawControlsMesh(painter, selectedVertices, *inputMesh);
|
||||
}
|
||||
|
||||
void MeshTextureMapper::_doDraw(QPainter* painter)
|
||||
@@ -451,16 +451,16 @@ EllipseTextureMapper::EllipseTextureMapper(std::tr1::shared_ptr<TextureMapping>
|
||||
{
|
||||
}
|
||||
|
||||
void EllipseTextureMapper::drawControls(QPainter* painter)
|
||||
void EllipseTextureMapper::drawControls(QPainter* painter, const QList<int>* selectedVertices)
|
||||
{
|
||||
std::tr1::shared_ptr<Ellipse> outputEllipse = std::tr1::static_pointer_cast<Ellipse>(outputShape);
|
||||
Util::drawControlsEllipse(painter, *outputEllipse);
|
||||
Util::drawControlsEllipse(painter, selectedVertices, *outputEllipse);
|
||||
}
|
||||
|
||||
void EllipseTextureMapper::drawInputControls(QPainter* painter)
|
||||
void EllipseTextureMapper::drawInputControls(QPainter* painter, const QList<int>* selectedVertices)
|
||||
{
|
||||
std::tr1::shared_ptr<Ellipse> inputEllipse = std::tr1::static_pointer_cast<Ellipse>(inputShape);
|
||||
Util::drawControlsEllipse(painter, *inputEllipse);
|
||||
Util::drawControlsEllipse(painter, selectedVertices, *inputEllipse);
|
||||
}
|
||||
|
||||
void EllipseTextureMapper::_doDraw(QPainter* painter)
|
||||
|
||||
@@ -80,13 +80,17 @@ public:
|
||||
virtual void draw(QPainter* painter) = 0;
|
||||
|
||||
/// Draws the output controls.
|
||||
virtual void drawControls(QPainter* painter) = 0;
|
||||
virtual void drawControls(QPainter* painter, const QList<int>* selectedVertices=0) = 0;
|
||||
|
||||
/// Draws the input (source) (if applicable).
|
||||
virtual void drawInput(QPainter* painter) { Q_UNUSED(painter); }
|
||||
|
||||
/// Draws the input (source) controls (if applicable).
|
||||
virtual void drawInputControls(QPainter* painter) { Q_UNUSED(painter); }
|
||||
virtual void drawInputControls(QPainter* painter, const QList<int>* selectedVertices=0)
|
||||
{
|
||||
Q_UNUSED(painter);
|
||||
Q_UNUSED(selectedVertices);
|
||||
}
|
||||
|
||||
public slots:
|
||||
virtual void setValue(QtProperty* property, const QVariant& value);
|
||||
@@ -140,7 +144,7 @@ public:
|
||||
virtual ~PolygonColorMapper() {}
|
||||
|
||||
virtual void draw(QPainter* painter);
|
||||
virtual void drawControls(QPainter* painter);
|
||||
virtual void drawControls(QPainter* painter, const QList<int>* selectedVertices=0);
|
||||
};
|
||||
|
||||
class MeshColorMapper : public ColorMapper
|
||||
@@ -152,7 +156,7 @@ public:
|
||||
virtual ~MeshColorMapper() {}
|
||||
|
||||
virtual void draw(QPainter* painter);
|
||||
virtual void drawControls(QPainter* painter);
|
||||
virtual void drawControls(QPainter* painter, const QList<int>* selectedVertices=0);
|
||||
|
||||
public slots:
|
||||
virtual void setValue(QtProperty* property, const QVariant& value);
|
||||
@@ -170,7 +174,7 @@ public:
|
||||
virtual ~EllipseColorMapper() {}
|
||||
|
||||
virtual void draw(QPainter* painter);
|
||||
virtual void drawControls(QPainter* painter);
|
||||
virtual void drawControls(QPainter* painter, const QList<int>* selectedVertices=0);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -191,8 +195,8 @@ public:
|
||||
virtual void draw(QPainter* painter);
|
||||
virtual void drawInput(QPainter* painter);
|
||||
|
||||
virtual void drawControls(QPainter* painter) = 0;
|
||||
virtual void drawInputControls(QPainter* painter) = 0;
|
||||
virtual void drawControls(QPainter* painter, const QList<int>* selectedVertices=0) = 0;
|
||||
virtual void drawInputControls(QPainter* painter, const QList<int>* selectedVertices=0) = 0;
|
||||
|
||||
public slots:
|
||||
virtual void updateShape(Shape* shape);
|
||||
@@ -221,8 +225,8 @@ public:
|
||||
PolygonTextureMapper(std::tr1::shared_ptr<TextureMapping> mapping) : TextureMapper(mapping) {}
|
||||
virtual ~PolygonTextureMapper() {}
|
||||
|
||||
virtual void drawControls(QPainter* painter);
|
||||
virtual void drawInputControls(QPainter* painter);
|
||||
virtual void drawControls(QPainter* painter, const QList<int>* selectedVertices=0);
|
||||
virtual void drawInputControls(QPainter* painter, const QList<int>* selectedVertices=0);
|
||||
};
|
||||
|
||||
class TriangleTextureMapper : public PolygonTextureMapper
|
||||
@@ -245,8 +249,8 @@ public:
|
||||
MeshTextureMapper(std::tr1::shared_ptr<TextureMapping> mapping);
|
||||
virtual ~MeshTextureMapper() {}
|
||||
|
||||
virtual void drawControls(QPainter* painter);
|
||||
virtual void drawInputControls(QPainter* painter);
|
||||
virtual void drawControls(QPainter* painter, const QList<int>* selectedVertices=0);
|
||||
virtual void drawInputControls(QPainter* painter, const QList<int>* selectedVertices=0);
|
||||
|
||||
public slots:
|
||||
virtual void setValue(QtProperty* property, const QVariant& value);
|
||||
@@ -265,8 +269,8 @@ public:
|
||||
EllipseTextureMapper(std::tr1::shared_ptr<TextureMapping> mapping);
|
||||
virtual ~EllipseTextureMapper() {}
|
||||
|
||||
virtual void drawControls(QPainter* painter);
|
||||
virtual void drawInputControls(QPainter* painter);
|
||||
virtual void drawControls(QPainter* painter, const QList<int>* selectedVertices=0);
|
||||
virtual void drawInputControls(QPainter* painter, const QList<int>* selectedVertices=0);
|
||||
|
||||
protected:
|
||||
virtual void _doDraw(QPainter* painter);
|
||||
|
||||
+42
-21
@@ -25,7 +25,7 @@
|
||||
MapperGLCanvas::MapperGLCanvas(MainWindow* mainWindow, QWidget* parent, const QGLWidget * shareWidget)
|
||||
: QGLWidget(QGLFormat(QGL::SampleBuffers), parent, shareWidget),
|
||||
_mainWindow(mainWindow),
|
||||
_mousePressedToDragVertex(false),
|
||||
_mousePressedOnVertex(false),
|
||||
_activeVertex(NO_VERTEX),
|
||||
_shapeGrabbed(false), // comment out?
|
||||
_shapeFirstGrab(false), // comment out?
|
||||
@@ -103,7 +103,11 @@ void MapperGLCanvas::mousePressEvent(QMouseEvent* event)
|
||||
int i;
|
||||
int dist;
|
||||
int minDistance;
|
||||
const QPointF& mousePos = event->posF();
|
||||
|
||||
bool mousePressedOnSomething = false;
|
||||
|
||||
_mousePressedPosition = event->pos();
|
||||
|
||||
// Note: we compare with the square value for fastest computation of the distance
|
||||
minDistance = MM::VERTEX_SELECT_RADIUS * MM::VERTEX_SELECT_RADIUS;
|
||||
|
||||
@@ -116,31 +120,37 @@ void MapperGLCanvas::mousePressEvent(QMouseEvent* event)
|
||||
// find the ID of the nearest vertex: (from the selected shape)
|
||||
for (i = 0; i < shape->nVertices(); i++)
|
||||
{
|
||||
dist = distSq(mousePos, shape->getVertex(i)); // squared distance
|
||||
dist = distSq(_mousePressedPosition, shape->getVertex(i)); // squared distance
|
||||
if (dist < minDistance)
|
||||
{
|
||||
_activeVertex = i;
|
||||
minDistance = dist;
|
||||
_mousePressedToDragVertex = true;
|
||||
_mousePressedOnVertex = true;
|
||||
mousePressedOnSomething = true;
|
||||
}
|
||||
}
|
||||
if (_mousePressedToDragVertex) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mousePressedOnSomething)
|
||||
return;
|
||||
|
||||
// Select a shape with a click.
|
||||
if (event->buttons() & Qt::LeftButton)
|
||||
{
|
||||
// Select a shape with a click
|
||||
Shape* orig = getCurrentShape();
|
||||
MappingManager manager = getMainWindow()->getMappingManager();
|
||||
QVector<Mapping::ptr> mappings = manager.getVisibleMappings();
|
||||
for (QVector<Mapping::ptr>::const_iterator it = mappings.end() - 1; it >= mappings.begin(); --it)
|
||||
{
|
||||
Shape *shape = getShapeFromMappingId((*it)->getId());
|
||||
if (shape && shape->includesPoint(mousePos))
|
||||
// Mouse pressed on a shape.
|
||||
if (shape && shape->includesPoint(_mousePressedPosition))
|
||||
{
|
||||
mousePressedOnSomething = true;
|
||||
// Deselect vertices.
|
||||
deselectVertices();
|
||||
// Change mapping.
|
||||
if (shape != orig)
|
||||
{
|
||||
getMainWindow()->setCurrentMapping((*it)->getId());
|
||||
@@ -148,31 +158,36 @@ void MapperGLCanvas::mousePressEvent(QMouseEvent* event)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Drag the currently selected shape
|
||||
if (event->buttons() & Qt::LeftButton)
|
||||
{
|
||||
Shape* shape = getCurrentShape();
|
||||
if (shape && shape->includesPoint(mousePos))
|
||||
// Grab the shape.
|
||||
if (orig && orig->includesPoint(_mousePressedPosition))
|
||||
{
|
||||
_shapeGrabbed = true;
|
||||
_shapeFirstGrab = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (mousePressedOnSomething)
|
||||
return;
|
||||
|
||||
// Deactivate.
|
||||
deselectAll();
|
||||
}
|
||||
|
||||
void MapperGLCanvas::mouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
// std::cout << "Mouse Release event " << std::endl;
|
||||
_mousePressedToDragVertex = false;
|
||||
// // Click on vertex ==> select the vertex.
|
||||
// if ((event->buttons() & Qt::LeftButton) && _mousePressedOnVertex)
|
||||
// {
|
||||
// }
|
||||
_mousePressedOnVertex = false;
|
||||
_shapeGrabbed = false;
|
||||
}
|
||||
|
||||
void MapperGLCanvas::mouseMoveEvent(QMouseEvent* event)
|
||||
{
|
||||
if (_mousePressedToDragVertex)
|
||||
if (_mousePressedOnVertex)
|
||||
{
|
||||
// std::cout << "Move event " << std::endl;
|
||||
Shape* shape = getCurrentShape();
|
||||
@@ -200,7 +215,7 @@ void MapperGLCanvas::mouseMoveEvent(QMouseEvent* event)
|
||||
if (shape)
|
||||
{
|
||||
if (!_shapeFirstGrab)
|
||||
{
|
||||
{
|
||||
shape->translate(event->x() - prevMousePosition.x(), event->y() - prevMousePosition.y());
|
||||
update();
|
||||
emit shapeChanged(getCurrentShape());
|
||||
@@ -311,10 +326,16 @@ void MapperGLCanvas::glueVertex(Shape *orig, QPointF *p)
|
||||
}
|
||||
}
|
||||
|
||||
void MapperGLCanvas::deselectAll()
|
||||
|
||||
void MapperGLCanvas::deselectVertices()
|
||||
{
|
||||
_activeVertex = NO_VERTEX;
|
||||
_mousePressedOnVertex = false;
|
||||
}
|
||||
|
||||
void MapperGLCanvas::deselectAll()
|
||||
{
|
||||
deselectVertices();
|
||||
_shapeGrabbed = false;
|
||||
_shapeFirstGrab = false;
|
||||
_mousePressedToDragVertex = false;
|
||||
}
|
||||
|
||||
+11
-2
@@ -53,6 +53,8 @@ public:
|
||||
MainWindow* getMainWindow() const { return _mainWindow; }
|
||||
bool displayControls() const { return _displayControls; }
|
||||
bool stickyVertices() const { return _stickyVertices; }
|
||||
bool hasActiveVertex() const { return _activeVertex != NO_VERTEX; }
|
||||
int getActiveVertexIndex() const { return _activeVertex; }
|
||||
|
||||
protected:
|
||||
void initializeGL();
|
||||
@@ -65,14 +67,20 @@ protected:
|
||||
void mouseReleaseEvent(QMouseEvent* event);
|
||||
void paintEvent(QPaintEvent* event);
|
||||
|
||||
private:
|
||||
protected:
|
||||
void draw(QPainter* painter);
|
||||
void enterDraw(QPainter* painter);
|
||||
virtual void doDraw(QPainter* painter) = 0;
|
||||
void exitDraw(QPainter* painter);
|
||||
|
||||
private:
|
||||
MainWindow* _mainWindow;
|
||||
bool _mousePressedToDragVertex;
|
||||
|
||||
// Last point pressed.
|
||||
QPoint _mousePressedPosition;
|
||||
|
||||
// Mouse currently pressed inside a vertex.
|
||||
bool _mousePressedOnVertex;
|
||||
int _activeVertex;
|
||||
bool _shapeGrabbed;
|
||||
bool _shapeFirstGrab;
|
||||
@@ -87,6 +95,7 @@ public slots:
|
||||
void updateCanvas();
|
||||
void enableDisplayControls(bool display);
|
||||
void enableStickyVertices(bool display);
|
||||
void deselectVertices();
|
||||
void deselectAll();
|
||||
|
||||
public:
|
||||
|
||||
+8
-2
@@ -47,14 +47,20 @@ void SourceGLCanvas::doDraw(QPainter* painter)
|
||||
if (getMainWindow()->hasCurrentMapping())
|
||||
{
|
||||
uint mappingId = getMainWindow()->getCurrentMappingId();
|
||||
Mapper::ptr mapper = getMainWindow()->getMapperByMappingId(mappingId);
|
||||
const Mapper::ptr& mapper = getMainWindow()->getMapperByMappingId(mappingId);
|
||||
painter->save();
|
||||
mapper->drawInput(painter);
|
||||
painter->restore();
|
||||
if (displayControls())
|
||||
{
|
||||
painter->save();
|
||||
mapper->drawInputControls(painter);
|
||||
if (hasActiveVertex()) {
|
||||
QList<int> selectedVertices;
|
||||
selectedVertices.append(getActiveVertexIndex());
|
||||
mapper->drawInputControls(painter, &selectedVertices);
|
||||
}
|
||||
else
|
||||
mapper->drawInputControls(painter);
|
||||
painter->restore();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,16 +150,10 @@ Ellipse* createEllipseForColor(int frameWidth, int frameHeight)
|
||||
);
|
||||
}
|
||||
|
||||
void drawControlsVertices(QPainter* painter, const Shape& shape)
|
||||
{
|
||||
for (int i=0; i<shape.nVertices(); i++)
|
||||
drawControlsVertex(painter, shape.getVertex(i));
|
||||
}
|
||||
|
||||
void drawControlsVertex(QPainter* painter, const QPointF& vertex, qreal radius, qreal strokeWidth)
|
||||
void drawControlsVertex(QPainter* painter, const QPointF& vertex, bool selected, qreal radius, qreal strokeWidth)
|
||||
{
|
||||
// Init colors and stroke.
|
||||
painter->setBrush(MM::VERTEX_BACKGROUND);
|
||||
painter->setBrush(selected ? MM::VERTEX_SELECTED_BACKGROUND : MM::VERTEX_BACKGROUND);
|
||||
painter->setPen(QPen(MM::CONTROL_COLOR, strokeWidth));
|
||||
|
||||
// Draw ellipse.
|
||||
@@ -171,7 +165,17 @@ void drawControlsVertex(QPainter* painter, const QPointF& vertex, qreal radius,
|
||||
painter->drawLine( vertex + QPointF(offset, -offset), vertex + QPointF(-offset, offset) );
|
||||
}
|
||||
|
||||
void drawControlsEllipse(QPainter* painter, const Ellipse& ellipse)
|
||||
void drawControlsVertices(QPainter* painter, const QList<int>* selectedVertices, const Shape& shape)
|
||||
{
|
||||
if (!selectedVertices)
|
||||
for (int i=0; i<shape.nVertices(); i++)
|
||||
drawControlsVertex(painter, shape.getVertex(i), false);
|
||||
else
|
||||
for (int i=0; i<shape.nVertices(); i++)
|
||||
drawControlsVertex(painter, shape.getVertex(i), selectedVertices->contains(i));
|
||||
}
|
||||
|
||||
void drawControlsEllipse(QPainter* painter, const QList<int>* selectedVertices, const Ellipse& ellipse)
|
||||
{
|
||||
// Init colors and stroke.
|
||||
painter->setPen(MM::SHAPE_STROKE);
|
||||
@@ -191,10 +195,10 @@ void drawControlsEllipse(QPainter* painter, const Ellipse& ellipse)
|
||||
painter->restore(); // restore saved painter state
|
||||
|
||||
// Draw control points.
|
||||
drawControlsVertices(painter, ellipse);
|
||||
drawControlsVertices(painter, selectedVertices, ellipse);
|
||||
}
|
||||
|
||||
void drawControlsQuad(QPainter* painter, const Quad& quad)
|
||||
void drawControlsQuad(QPainter* painter, const QList<int>* selectedVertices, const Quad& quad)
|
||||
{
|
||||
// Init colors and stroke.
|
||||
painter->setPen(MM::SHAPE_STROKE);
|
||||
@@ -203,10 +207,10 @@ void drawControlsQuad(QPainter* painter, const Quad& quad)
|
||||
painter->drawPolygon(quad.toPolygon());
|
||||
|
||||
// Draw control points.
|
||||
drawControlsVertices(painter, quad);
|
||||
drawControlsVertices(painter, selectedVertices, quad);
|
||||
}
|
||||
|
||||
void drawControlsMesh(QPainter* painter, const Mesh& mesh)
|
||||
void drawControlsMesh(QPainter* painter, const QList<int>* selectedVertices, const Mesh& mesh)
|
||||
{
|
||||
// Init colors and stroke.
|
||||
painter->setPen(MM::SHAPE_INNER_STROKE);
|
||||
@@ -223,10 +227,10 @@ void drawControlsMesh(QPainter* painter, const Mesh& mesh)
|
||||
painter->drawPolygon(mesh.toPolygon());
|
||||
|
||||
// Draw control points.
|
||||
drawControlsVertices(painter, mesh);
|
||||
drawControlsVertices(painter, selectedVertices, mesh);
|
||||
}
|
||||
|
||||
void drawControlsPolygon(QPainter* painter, const Polygon& polygon)
|
||||
void drawControlsPolygon(QPainter* painter, const QList<int>* selectedVertices, const Polygon& polygon)
|
||||
{
|
||||
// Init colors and stroke.
|
||||
painter->setPen(MM::SHAPE_STROKE);
|
||||
@@ -235,7 +239,7 @@ void drawControlsPolygon(QPainter* painter, const Polygon& polygon)
|
||||
painter->drawPolygon(polygon.toPolygon());
|
||||
|
||||
// Draw control points.
|
||||
drawControlsVertices(painter, polygon);
|
||||
drawControlsVertices(painter, selectedVertices, polygon);
|
||||
}
|
||||
|
||||
bool fileExists(const QString& filename)
|
||||
|
||||
@@ -57,12 +57,13 @@ Quad* createQuadForColor(int frameWidth, int frameHeight);
|
||||
Triangle* createTriangleForColor(int frameWidth, int frameHeight);
|
||||
Ellipse* createEllipseForColor(int frameWidth, int frameHeight);
|
||||
|
||||
void drawControlsVertices(QPainter* painter, const Shape& shape);
|
||||
void drawControlsVertex(QPainter* painter, const QPointF& vertex, qreal radius = MM::VERTEX_SELECT_RADIUS, qreal strokeWidth = MM::VERTEX_SELECT_STROKE_WIDTH);
|
||||
void drawControlsEllipse(QPainter* painter, const Ellipse& ellipse);
|
||||
void drawControlsQuad(QPainter* painter, const Quad& quad);
|
||||
void drawControlsMesh(QPainter* painter, const Mesh& mesh);
|
||||
void drawControlsPolygon(QPainter* painter, const Polygon& polygon);
|
||||
void drawControlsVertex(QPainter* painter, const QPointF& vertex, bool selected, qreal radius = MM::VERTEX_SELECT_RADIUS, qreal strokeWidth = MM::VERTEX_SELECT_STROKE_WIDTH);
|
||||
|
||||
void drawControlsVertices(QPainter* painter, const QList<int>* selectedVertices, const Shape& shape);
|
||||
void drawControlsEllipse(QPainter* painter, const QList<int>* selectedVertices, const Ellipse& ellipse);
|
||||
void drawControlsQuad(QPainter* painter, const QList<int>* selectedVertices, const Quad& quad);
|
||||
void drawControlsMesh(QPainter* painter, const QList<int>* selectedVertices, const Mesh& mesh);
|
||||
void drawControlsPolygon(QPainter* painter, const QList<int>* selectedVertices, const Polygon& polygon);
|
||||
|
||||
/**
|
||||
* Checks if a file exists or not.
|
||||
|
||||
Reference in New Issue
Block a user