mirror of
https://github.com/mapmapteam/mapmap.git
synced 2026-06-16 12:33:19 +02:00
Some cleanup / reorganization of code
This commit is contained in:
+26
-32
@@ -63,34 +63,6 @@ QWidget* Mapper::getPropertiesEditor()
|
||||
return _propertyBrowser;
|
||||
}
|
||||
|
||||
TextureMapper::TextureMapper(std::tr1::shared_ptr<TextureMapping> mapping)
|
||||
: Mapper(mapping)
|
||||
{
|
||||
// Assign members pointers.
|
||||
textureMapping = std::tr1::static_pointer_cast<TextureMapping>(_mapping);
|
||||
Q_CHECK_PTR(textureMapping);
|
||||
|
||||
texture = std::tr1::static_pointer_cast<Texture>(textureMapping->getPaint());
|
||||
Q_CHECK_PTR(texture);
|
||||
|
||||
inputShape = std::tr1::static_pointer_cast<Shape>(textureMapping->getInputShape());
|
||||
Q_CHECK_PTR(inputShape);
|
||||
|
||||
// Input shape.
|
||||
_inputItem = _variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),
|
||||
QObject::tr("Input shape"));
|
||||
|
||||
_buildShapeProperty(_inputItem, textureMapping->getInputShape().get());
|
||||
_topItem->insertSubProperty(_inputItem, 0); // insert before output item
|
||||
}
|
||||
|
||||
void TextureMapper::updatePaint()
|
||||
{
|
||||
texture.reset();
|
||||
texture = std::tr1::static_pointer_cast<Texture>(textureMapping->getPaint());
|
||||
Q_CHECK_PTR(texture);
|
||||
}
|
||||
|
||||
void Mapper::setValue(QtProperty* property, const QVariant& value)
|
||||
{
|
||||
std::map<QtProperty*, std::pair<Shape*, int> >::iterator it = _propertyToVertex.find(property);
|
||||
@@ -249,6 +221,28 @@ void EllipseColorMapper::drawControls(QPainter* painter)
|
||||
Util::drawControlsEllipse(painter, *outputEllipse);
|
||||
}
|
||||
|
||||
|
||||
TextureMapper::TextureMapper(std::tr1::shared_ptr<TextureMapping> mapping)
|
||||
: Mapper(mapping)
|
||||
{
|
||||
// Assign members pointers.
|
||||
textureMapping = std::tr1::static_pointer_cast<TextureMapping>(_mapping);
|
||||
Q_CHECK_PTR(textureMapping);
|
||||
|
||||
texture = std::tr1::static_pointer_cast<Texture>(textureMapping->getPaint());
|
||||
Q_CHECK_PTR(texture);
|
||||
|
||||
inputShape = std::tr1::static_pointer_cast<Shape>(textureMapping->getInputShape());
|
||||
Q_CHECK_PTR(inputShape);
|
||||
|
||||
// Input shape.
|
||||
_inputItem = _variantManager->addProperty(QtVariantPropertyManager::groupTypeId(),
|
||||
QObject::tr("Input shape"));
|
||||
|
||||
_buildShapeProperty(_inputItem, textureMapping->getInputShape().get());
|
||||
_topItem->insertSubProperty(_inputItem, 0); // insert before output item
|
||||
}
|
||||
|
||||
void TextureMapper::draw(QPainter* painter)
|
||||
{
|
||||
// Prepare drawing.
|
||||
@@ -308,7 +302,11 @@ void TextureMapper::updateShape(Shape* shape)
|
||||
|
||||
}
|
||||
|
||||
void TextureMapper::updatePaint()
|
||||
{
|
||||
texture.reset();
|
||||
texture = std::tr1::static_pointer_cast<Texture>(textureMapping->getPaint());
|
||||
Q_CHECK_PTR(texture);
|
||||
}
|
||||
|
||||
void TextureMapper::_preDraw(QPainter* painter)
|
||||
@@ -338,13 +336,9 @@ void TextureMapper::_preDraw(QPainter* painter)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
void TextureMapper::drawControls(QPainter* painter)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TextureMapper::_postDraw(QPainter* painter)
|
||||
void TextureMapper::drawInputControls(QPainter* painter)
|
||||
{
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
|
||||
|
||||
@@ -87,18 +87,14 @@ public:
|
||||
|
||||
public slots:
|
||||
virtual void setValue(QtProperty* property, const QVariant& value);
|
||||
virtual void updateShape(Shape* shape)
|
||||
{
|
||||
Q_UNUSED(shape);
|
||||
}
|
||||
virtual void updatePaint()
|
||||
{
|
||||
}
|
||||
virtual void updateShape(Shape* shape) { Q_UNUSED(shape); }
|
||||
virtual void updatePaint() {}
|
||||
|
||||
signals:
|
||||
void valueChanged();
|
||||
|
||||
protected:
|
||||
Mapping::ptr _mapping;
|
||||
QtAbstractPropertyBrowser* _propertyBrowser;
|
||||
QtVariantEditorFactory* _variantFactory;
|
||||
QtVariantPropertyManager* _variantManager;
|
||||
@@ -192,8 +188,8 @@ public:
|
||||
virtual void draw(QPainter* painter);
|
||||
virtual void drawInput(QPainter* painter);
|
||||
|
||||
virtual void drawControls(QPainter* painter);
|
||||
virtual void drawInputControls(QPainter* painter);
|
||||
virtual void drawControls(QPainter* painter) = 0;
|
||||
virtual void drawInputControls(QPainter* painter) = 0;
|
||||
|
||||
public slots:
|
||||
virtual void updateShape(Shape* shape);
|
||||
|
||||
Reference in New Issue
Block a user