mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
Replaced Shape by MShape to avoid name conflicts.
This commit is contained in:
@@ -27,7 +27,7 @@ DestinationGLCanvas::DestinationGLCanvas(MainWindow* mainWindow, QWidget* parent
|
||||
{
|
||||
}
|
||||
|
||||
Shape* DestinationGLCanvas::getShapeFromMappingId(uid mappingId)
|
||||
MShape* DestinationGLCanvas::getShapeFromMappingId(uid mappingId)
|
||||
{
|
||||
if (mappingId == NULL_UID)
|
||||
return NULL;
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
DestinationGLCanvas(MainWindow* mainWindow, QWidget* parent = 0, const QGLWidget * shareWidget = 0);
|
||||
// virtual ~DestinationGLCanvas();
|
||||
|
||||
virtual Shape* getShapeFromMappingId(uid mappingId);
|
||||
virtual MShape* getShapeFromMappingId(uid mappingId);
|
||||
|
||||
void setDisplayCrosshair(bool displayCrosshair) {
|
||||
_displayCrosshair = displayCrosshair;
|
||||
|
||||
+18
-18
@@ -409,7 +409,7 @@ void MainWindow::addMesh()
|
||||
Mapping* mappingPtr;
|
||||
if (paint->getType() == "color")
|
||||
{
|
||||
Shape::ptr outputQuad = Shape::ptr(Util::createQuadForColor(sourceCanvas->width(), sourceCanvas->height()));
|
||||
MShape::ptr outputQuad = MShape::ptr(Util::createQuadForColor(sourceCanvas->width(), sourceCanvas->height()));
|
||||
mappingPtr = new ColorMapping(paint, outputQuad);
|
||||
}
|
||||
else
|
||||
@@ -417,8 +417,8 @@ void MainWindow::addMesh()
|
||||
std::tr1::shared_ptr<Texture> texture = std::tr1::static_pointer_cast<Texture>(paint);
|
||||
Q_CHECK_PTR(texture);
|
||||
|
||||
Shape::ptr outputQuad = Shape::ptr(Util::createMeshForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
Shape::ptr inputQuad = Shape::ptr(Util::createMeshForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
MShape::ptr outputQuad = MShape::ptr(Util::createMeshForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
MShape::ptr inputQuad = MShape::ptr(Util::createMeshForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
mappingPtr = new TextureMapping(paint, outputQuad, inputQuad);
|
||||
}
|
||||
|
||||
@@ -442,7 +442,7 @@ void MainWindow::addTriangle()
|
||||
Mapping* mappingPtr;
|
||||
if (paint->getType() == "color")
|
||||
{
|
||||
Shape::ptr outputTriangle = Shape::ptr(Util::createTriangleForColor(sourceCanvas->width(), sourceCanvas->height()));
|
||||
MShape::ptr outputTriangle = MShape::ptr(Util::createTriangleForColor(sourceCanvas->width(), sourceCanvas->height()));
|
||||
mappingPtr = new ColorMapping(paint, outputTriangle);
|
||||
}
|
||||
else
|
||||
@@ -450,8 +450,8 @@ void MainWindow::addTriangle()
|
||||
std::tr1::shared_ptr<Texture> texture = std::tr1::static_pointer_cast<Texture>(paint);
|
||||
Q_CHECK_PTR(texture);
|
||||
|
||||
Shape::ptr outputTriangle = Shape::ptr(Util::createTriangleForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
Shape::ptr inputTriangle = Shape::ptr(Util::createTriangleForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
MShape::ptr outputTriangle = MShape::ptr(Util::createTriangleForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
MShape::ptr inputTriangle = MShape::ptr(Util::createTriangleForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
mappingPtr = new TextureMapping(paint, inputTriangle, outputTriangle);
|
||||
}
|
||||
|
||||
@@ -475,7 +475,7 @@ void MainWindow::addEllipse()
|
||||
Mapping* mappingPtr;
|
||||
if (paint->getType() == "color")
|
||||
{
|
||||
Shape::ptr outputEllipse = Shape::ptr(Util::createEllipseForColor(sourceCanvas->width(), sourceCanvas->height()));
|
||||
MShape::ptr outputEllipse = MShape::ptr(Util::createEllipseForColor(sourceCanvas->width(), sourceCanvas->height()));
|
||||
mappingPtr = new ColorMapping(paint, outputEllipse);
|
||||
}
|
||||
else
|
||||
@@ -483,8 +483,8 @@ void MainWindow::addEllipse()
|
||||
std::tr1::shared_ptr<Texture> texture = std::tr1::static_pointer_cast<Texture>(paint);
|
||||
Q_CHECK_PTR(texture);
|
||||
|
||||
Shape::ptr outputEllipse = Shape::ptr(Util::createEllipseForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
Shape::ptr inputEllipse = Shape::ptr(Util::createEllipseForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
MShape::ptr outputEllipse = MShape::ptr(Util::createEllipseForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
MShape::ptr inputEllipse = MShape::ptr(Util::createEllipseForTexture(texture.get(), sourceCanvas->width(), sourceCanvas->height()));
|
||||
mappingPtr = new TextureMapping(paint, inputEllipse, outputEllipse);
|
||||
}
|
||||
|
||||
@@ -722,8 +722,8 @@ uid MainWindow::createMeshTextureMapping(uid mappingId,
|
||||
qDebug() << nVertices << " vs " << nColumns << "x" << nRows << " vs " << src.size() << " " << dst.size() << endl;
|
||||
Q_ASSERT(src.size() == nVertices && dst.size() == nVertices);
|
||||
|
||||
Shape::ptr inputMesh( new Mesh(src, nColumns, nRows));
|
||||
Shape::ptr outputMesh(new Mesh(dst, nColumns, nRows));
|
||||
MShape::ptr inputMesh( new Mesh(src, nColumns, nRows));
|
||||
MShape::ptr outputMesh(new Mesh(dst, nColumns, nRows));
|
||||
|
||||
// Add it to the manager.
|
||||
Mapping::ptr mapping(new TextureMapping(paint, outputMesh, inputMesh, mappingId));
|
||||
@@ -752,8 +752,8 @@ uid MainWindow::createTriangleTextureMapping(uid mappingId,
|
||||
Paint::ptr paint = mappingManager->getPaintById(paintId);
|
||||
Q_ASSERT(src.size() == 3 && dst.size() == 3);
|
||||
|
||||
Shape::ptr inputTriangle( new Triangle(src[0], src[1], src[2]));
|
||||
Shape::ptr outputTriangle(new Triangle(dst[0], dst[1], dst[2]));
|
||||
MShape::ptr inputTriangle( new Triangle(src[0], src[1], src[2]));
|
||||
MShape::ptr outputTriangle(new Triangle(dst[0], dst[1], dst[2]));
|
||||
|
||||
// Add it to the manager.
|
||||
Mapping::ptr mapping(new TextureMapping(paint, outputTriangle, inputTriangle, mappingId));
|
||||
@@ -782,8 +782,8 @@ uid MainWindow::createEllipseTextureMapping(uid mappingId,
|
||||
Paint::ptr paint = mappingManager->getPaintById(paintId);
|
||||
Q_ASSERT(src.size() == 5 && dst.size() == 5);
|
||||
|
||||
Shape::ptr inputEllipse( new Ellipse(src[0], src[1], src[2], src[3], src[4]));
|
||||
Shape::ptr outputEllipse(new Ellipse(dst[0], dst[1], dst[2], dst[3], dst[4]));
|
||||
MShape::ptr inputEllipse( new Ellipse(src[0], src[1], src[2], src[3], src[4]));
|
||||
MShape::ptr outputEllipse(new Ellipse(dst[0], dst[1], dst[2], dst[3], dst[4]));
|
||||
|
||||
// Add it to the manager.
|
||||
Mapping::ptr mapping(new TextureMapping(paint, outputEllipse, inputEllipse, mappingId));
|
||||
@@ -812,7 +812,7 @@ uid MainWindow::createQuadColorMapping(uid mappingId,
|
||||
Paint::ptr paint = mappingManager->getPaintById(paintId);
|
||||
Q_ASSERT(dst.size() == 4);
|
||||
|
||||
Shape::ptr outputQuad(new Quad(dst[0], dst[1], dst[2], dst[3]));
|
||||
MShape::ptr outputQuad(new Quad(dst[0], dst[1], dst[2], dst[3]));
|
||||
|
||||
// Add it to the manager.
|
||||
Mapping::ptr mapping(new ColorMapping(paint, outputQuad, mappingId));
|
||||
@@ -841,7 +841,7 @@ uid MainWindow::createTriangleColorMapping(uid mappingId,
|
||||
Paint::ptr paint = mappingManager->getPaintById(paintId);
|
||||
Q_ASSERT(dst.size() == 3);
|
||||
|
||||
Shape::ptr outputTriangle(new Triangle(dst[0], dst[1], dst[2]));
|
||||
MShape::ptr outputTriangle(new Triangle(dst[0], dst[1], dst[2]));
|
||||
|
||||
// Add it to the manager.
|
||||
Mapping::ptr mapping(new ColorMapping(paint, outputTriangle, mappingId));
|
||||
@@ -870,7 +870,7 @@ uid MainWindow::createEllipseColorMapping(uid mappingId,
|
||||
Paint::ptr paint = mappingManager->getPaintById(paintId);
|
||||
Q_ASSERT(dst.size() == 4);
|
||||
|
||||
Shape::ptr outputEllipse(new Ellipse(dst[0], dst[1], dst[2], dst[3]));
|
||||
MShape::ptr outputEllipse(new Ellipse(dst[0], dst[1], dst[2], dst[3]));
|
||||
|
||||
// Add it to the manager.
|
||||
Mapping::ptr mapping(new ColorMapping(paint, outputEllipse, mappingId));
|
||||
|
||||
+8
-8
@@ -65,11 +65,11 @@ QWidget* Mapper::getPropertiesEditor()
|
||||
|
||||
void Mapper::setValue(QtProperty* property, const QVariant& value)
|
||||
{
|
||||
std::map<QtProperty*, std::pair<Shape*, int> >::iterator it = _propertyToVertex.find(property);
|
||||
std::map<QtProperty*, std::pair<MShape*, int> >::iterator it = _propertyToVertex.find(property);
|
||||
if (it != _propertyToVertex.end())
|
||||
{
|
||||
const QPointF& p = value.toPointF();
|
||||
Shape* shape = it->second.first;
|
||||
MShape* shape = it->second.first;
|
||||
int v = it->second.second;
|
||||
if (shape->getVertex(v) != p)
|
||||
{
|
||||
@@ -79,7 +79,7 @@ void Mapper::setValue(QtProperty* property, const QVariant& value)
|
||||
}
|
||||
}
|
||||
|
||||
void Mapper::_buildShapeProperty(QtProperty* shapeItem, Shape* shape)
|
||||
void Mapper::_buildShapeProperty(QtProperty* shapeItem, MShape* shape)
|
||||
{
|
||||
for (int i=0; i<shape->nVertices(); i++)
|
||||
{
|
||||
@@ -96,7 +96,7 @@ void Mapper::_buildShapeProperty(QtProperty* shapeItem, Shape* shape)
|
||||
|
||||
}
|
||||
|
||||
void Mapper::_updateShapeProperty(QtProperty* shapeItem, Shape* shape)
|
||||
void Mapper::_updateShapeProperty(QtProperty* shapeItem, MShape* shape)
|
||||
{
|
||||
QList<QtProperty*> pointItems = shapeItem->subProperties();
|
||||
for (int i=0; i<shape->nVertices(); i++)
|
||||
@@ -233,7 +233,7 @@ TextureMapper::TextureMapper(std::tr1::shared_ptr<TextureMapping> mapping)
|
||||
texture = std::tr1::static_pointer_cast<Texture>(textureMapping->getPaint());
|
||||
Q_CHECK_PTR(texture);
|
||||
|
||||
inputShape = std::tr1::static_pointer_cast<Shape>(textureMapping->getInputShape());
|
||||
inputShape = std::tr1::static_pointer_cast<MShape>(textureMapping->getInputShape());
|
||||
Q_CHECK_PTR(inputShape);
|
||||
|
||||
// Input shape.
|
||||
@@ -282,7 +282,7 @@ void TextureMapper::drawInput(QPainter* painter)
|
||||
_postDraw(painter);
|
||||
}
|
||||
|
||||
void TextureMapper::updateShape(Shape* shape)
|
||||
void TextureMapper::updateShape(MShape* shape)
|
||||
{
|
||||
std::tr1::shared_ptr<TextureMapping> textureMapping = std::tr1::static_pointer_cast<TextureMapping>(_mapping);
|
||||
Q_CHECK_PTR(textureMapping);
|
||||
@@ -290,8 +290,8 @@ void TextureMapper::updateShape(Shape* shape)
|
||||
std::tr1::shared_ptr<Texture> texture = std::tr1::static_pointer_cast<Texture>(textureMapping->getPaint());
|
||||
Q_CHECK_PTR(texture);
|
||||
|
||||
Shape* inputShape = textureMapping->getInputShape().get();
|
||||
Shape* outputShape = textureMapping->getShape().get();
|
||||
MShape* inputShape = textureMapping->getInputShape().get();
|
||||
MShape* outputShape = textureMapping->getShape().get();
|
||||
if (shape == inputShape)
|
||||
{
|
||||
_updateShapeProperty(_inputItem, inputShape);
|
||||
|
||||
+2
-2
@@ -351,12 +351,12 @@ void MapperGLCanvas::enableStickyVertices(bool value)
|
||||
/* Stick vertex p of Shape orig to another Shape's vertex, if the 2 vertices are
|
||||
* close enough. The distance per coordinate is currently set in dist_stick
|
||||
* variable. Perhaps the sticky-sensitivity should be configurable through GUI */
|
||||
void MapperGLCanvas::glueVertex(Shape *orig, QPointF *p)
|
||||
void MapperGLCanvas::glueVertex(MShape *orig, QPointF *p)
|
||||
{
|
||||
MappingManager manager = getMainWindow()->getMappingManager();
|
||||
for (int i = 0; i < manager.nMappings(); i++)
|
||||
{
|
||||
Shape *shape = getShapeFromMappingId(manager.getMapping(i)->getId());
|
||||
MShape *shape = getShapeFromMappingId(manager.getMapping(i)->getId());
|
||||
if (shape && shape != orig)
|
||||
{
|
||||
for (int vertex = 0; vertex < shape->nVertices(); vertex++)
|
||||
|
||||
+4
-4
@@ -45,13 +45,13 @@ public:
|
||||
virtual ~MapperGLCanvas() {}
|
||||
|
||||
/// Returns shape associated with mapping id.
|
||||
virtual Shape* getShapeFromMappingId(uid mappingId) = 0;
|
||||
virtual MShape* getShapeFromMappingId(uid mappingId) = 0;
|
||||
|
||||
// QSize sizeHint() const;
|
||||
// QSize minimumSizeHint() const;
|
||||
|
||||
/// Returns current shape.
|
||||
Shape* getCurrentShape();
|
||||
// Shape* getCurrentShape();
|
||||
|
||||
/**
|
||||
* Stick vertex p of Shape orig to another Shape's vertex, if the 2 vertices are
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
* variable.
|
||||
*/
|
||||
// TODO: Perhaps the sticky-sensitivity should be configurable through GUI
|
||||
void glueVertex(Shape *, QPointF *);
|
||||
void glueVertex(MShape *, QPointF *);
|
||||
|
||||
/// Returns pointer to main window.
|
||||
MainWindow* getMainWindow() const { return _mainWindow; }
|
||||
@@ -133,7 +133,7 @@ private:
|
||||
bool _stickyVertices;
|
||||
|
||||
signals:
|
||||
void shapeChanged(Shape*);
|
||||
void shapeChanged(MShape*);
|
||||
void imageChanged();
|
||||
|
||||
public slots:
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
|
||||
UidAllocator Mapping::allocator;
|
||||
|
||||
Mapping::Mapping(Paint::ptr paint, Shape::ptr shape, uid id)
|
||||
Mapping::Mapping(Paint::ptr paint, MShape::ptr shape, uid id)
|
||||
: _paint(paint), _shape(shape),
|
||||
_isLocked(false), _isSolo(false), _isVisible(true), _opacity(1.0f)
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ protected:
|
||||
Paint::ptr _paint;
|
||||
|
||||
/// The output Shape instance.
|
||||
Shape::ptr _shape;
|
||||
MShape::ptr _shape;
|
||||
|
||||
private:
|
||||
static UidAllocator allocator;
|
||||
@@ -60,7 +60,7 @@ private:
|
||||
|
||||
protected:
|
||||
/// Constructor.
|
||||
Mapping(Paint::ptr paint, Shape::ptr shape, uid id=NULL_UID);
|
||||
Mapping(Paint::ptr paint, MShape::ptr shape, uid id=NULL_UID);
|
||||
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<Mapping> ptr;
|
||||
@@ -85,13 +85,13 @@ public:
|
||||
Paint::ptr getPaint() const { return _paint; }
|
||||
|
||||
/// Returns the (output) shape.
|
||||
Shape::ptr getShape() const { return _shape; }
|
||||
MShape::ptr getShape() const { return _shape; }
|
||||
|
||||
/// Returns true iff the mapping possesses an input (source) shape.
|
||||
virtual bool hasInputShape() const { return false; }
|
||||
|
||||
/// Returns the input (source) shape (if this mapping has one) or a null pointer if not.
|
||||
virtual Shape::ptr getInputShape() const { return Shape::ptr(); }
|
||||
virtual MShape::ptr getInputShape() const { return MShape::ptr(); }
|
||||
|
||||
uid getId() const { return _id; }
|
||||
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
class ColorMapping : public Mapping
|
||||
{
|
||||
public:
|
||||
ColorMapping(Paint::ptr paint, Shape::ptr shape,
|
||||
ColorMapping(Paint::ptr paint, MShape::ptr shape,
|
||||
uid id=NULL_UID)
|
||||
: Mapping(paint, shape, id) {}
|
||||
|
||||
@@ -138,12 +138,12 @@ public:
|
||||
class TextureMapping : public Mapping
|
||||
{
|
||||
private:
|
||||
Shape::ptr _inputShape;
|
||||
MShape::ptr _inputShape;
|
||||
|
||||
public:
|
||||
TextureMapping(Paint::ptr paint,
|
||||
Shape::ptr shape,
|
||||
Shape::ptr inputShape, uid id=NULL_UID)
|
||||
MShape::ptr shape,
|
||||
MShape::ptr inputShape, uid id=NULL_UID)
|
||||
: Mapping(paint, shape, id),
|
||||
_inputShape(inputShape)
|
||||
{
|
||||
@@ -162,7 +162,7 @@ public:
|
||||
|
||||
public:
|
||||
virtual bool hasInputShape() const { return true; }
|
||||
virtual Shape::ptr getInputShape() const { return _inputShape; }
|
||||
virtual MShape::ptr getInputShape() const { return _inputShape; }
|
||||
};
|
||||
|
||||
#endif /* MAPPING_H_ */
|
||||
|
||||
+2
-2
@@ -117,7 +117,7 @@ void ProjectWriter::writeItem(Paint *item)
|
||||
qDebug() << "Unknown type, cannot save: " << item->getType() << endl;
|
||||
}
|
||||
|
||||
void ProjectWriter::writeShapeVertices(Shape *shape)
|
||||
void ProjectWriter::writeShapeVertices(MShape *shape)
|
||||
{
|
||||
if (shape->getType() == "mesh") {
|
||||
Mesh* mesh = (Mesh*) shape;
|
||||
@@ -150,7 +150,7 @@ void ProjectWriter::writeItem(Mapping *item)
|
||||
_xml.writeAttribute("solo", QString::number((int) item->isSolo() ? 1 : 0));
|
||||
_xml.writeAttribute("visible", QString::number((int) item->isVisible() ? 1 : 0));
|
||||
|
||||
Shape *shape = item->getShape().get();
|
||||
MShape *shape = item->getShape().get();
|
||||
_xml.writeStartElement("destination");
|
||||
_xml.writeAttribute("shape", shape->getType());
|
||||
writeShapeVertices(shape);
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ class ProjectWriter
|
||||
private:
|
||||
void writeItem (Paint *item);
|
||||
void writeItem (Mapping *item);
|
||||
void writeShapeVertices (Shape *shape);
|
||||
void writeShapeVertices (MShape *shape);
|
||||
QXmlStreamWriter _xml;
|
||||
MappingManager *_manager;
|
||||
};
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "Shape.h"
|
||||
|
||||
void Shape::translate(int x, int y)
|
||||
void MShape::translate(int x, int y)
|
||||
{
|
||||
for (QVector<QPointF>::iterator it = vertices.begin() ;
|
||||
it != vertices.end(); ++it)
|
||||
@@ -507,10 +507,10 @@ void Ellipse::setVertex(int i, const QPointF& v)
|
||||
transform *= fromUnitCircle();
|
||||
|
||||
// Set vertices.
|
||||
Shape::setVertex(1, transform.map( getVertex(1) ));
|
||||
Shape::setVertex(3, transform.map( getVertex(3) ));
|
||||
MShape::setVertex(1, transform.map( getVertex(1) ));
|
||||
MShape::setVertex(3, transform.map( getVertex(3) ));
|
||||
if (hasCenterControl())
|
||||
Shape::setVertex(4, transform.map( getVertex(4) ));
|
||||
MShape::setVertex(4, transform.map( getVertex(4) ));
|
||||
}
|
||||
|
||||
// If changed one of the two other points, just change the vertical axis.
|
||||
|
||||
@@ -42,16 +42,16 @@
|
||||
/**
|
||||
* Shape represented by a series of control points.
|
||||
*/
|
||||
class Shape
|
||||
class MShape
|
||||
{
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<Shape> ptr;
|
||||
typedef std::tr1::shared_ptr<MShape> ptr;
|
||||
|
||||
Shape() {}
|
||||
Shape(QVector<QPointF> vertices_) :
|
||||
MShape() {}
|
||||
MShape(QVector<QPointF> vertices_) :
|
||||
vertices(vertices_)
|
||||
{}
|
||||
virtual ~Shape() {}
|
||||
virtual ~MShape() {}
|
||||
|
||||
virtual void build() {}
|
||||
|
||||
@@ -105,10 +105,10 @@ protected:
|
||||
/**
|
||||
* This class represents a simple polygon (ie. the control points are vertices).
|
||||
*/
|
||||
class Polygon : public Shape {
|
||||
class Polygon : public MShape {
|
||||
public:
|
||||
Polygon() {}
|
||||
Polygon(QVector<QPointF> vertices_) : Shape(vertices_) {}
|
||||
Polygon(QVector<QPointF> vertices_) : MShape(vertices_) {}
|
||||
virtual ~Polygon() {}
|
||||
|
||||
virtual QPolygonF toPolygon() const;
|
||||
@@ -246,7 +246,7 @@ protected:
|
||||
void _reorderVertices();
|
||||
};
|
||||
|
||||
class Ellipse : public Shape {
|
||||
class Ellipse : public MShape {
|
||||
public:
|
||||
Ellipse() {}
|
||||
Ellipse(QPointF p1, QPointF p2, QPointF p3, QPointF p4, QPointF p5)
|
||||
@@ -284,13 +284,13 @@ public:
|
||||
|
||||
QVector2D vFromCenter = QVector2D(getVertex(1)) - center;
|
||||
const QVector2D& projection = QVector2D::dotProduct( vFromCenter, vAxisNormalized ) * vAxisNormalized;
|
||||
Shape::setVertex(1, (center + projection).toPointF());
|
||||
Shape::setVertex(3, (center - projection).toPointF());
|
||||
MShape::setVertex(1, (center + projection).toPointF());
|
||||
MShape::setVertex(3, (center - projection).toPointF());
|
||||
|
||||
if (hasCenterControl())
|
||||
{
|
||||
// Clip control point.
|
||||
Shape::setVertex(4, clipInside(getVertex(4)));
|
||||
MShape::setVertex(4, clipInside(getVertex(4)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ SourceGLCanvas::SourceGLCanvas(MainWindow* mainWindow, QWidget* parent)
|
||||
{
|
||||
}
|
||||
|
||||
Shape* SourceGLCanvas::getShapeFromMappingId(uid mappingId)
|
||||
MShape* SourceGLCanvas::getShapeFromMappingId(uid mappingId)
|
||||
{
|
||||
if (mappingId == NULL_UID)
|
||||
return NULL;
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ public:
|
||||
SourceGLCanvas(MainWindow* mainWindow, QWidget* parent = 0);
|
||||
// virtual ~SourceGLCanvas() {}
|
||||
|
||||
virtual Shape* getShapeFromMappingId(uid mappingId);
|
||||
virtual MShape* getShapeFromMappingId(uid mappingId);
|
||||
|
||||
private:
|
||||
virtual void doDraw(QPainter* painter);
|
||||
|
||||
@@ -165,7 +165,7 @@ void drawControlsVertex(QPainter* painter, const QPointF& vertex, bool selected,
|
||||
painter->drawLine( vertex + QPointF(offset, -offset), vertex + QPointF(-offset, offset) );
|
||||
}
|
||||
|
||||
void drawControlsVertices(QPainter* painter, const QList<int>* selectedVertices, const Shape& shape)
|
||||
void drawControlsVertices(QPainter* painter, const QList<int>* selectedVertices, const MShape& shape)
|
||||
{
|
||||
if (!selectedVertices)
|
||||
for (int i=0; i<shape.nVertices(); i++)
|
||||
|
||||
@@ -59,7 +59,7 @@ Ellipse* createEllipseForColor(int frameWidth, int frameHeight);
|
||||
|
||||
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 drawControlsVertices(QPainter* painter, const QList<int>* selectedVertices, const MShape& 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);
|
||||
|
||||
Reference in New Issue
Block a user