33 : QObject(), p_model_item(layer_view_item), m_sample_item_id(
" ")
276 if (layer_view_controller->
layerBelow() !=
this)
290 if (layer_view_controller->
layerAbove() !=
this)
405 auto brush = QBrush(Qt::SolidPattern);
423 auto brush = QBrush(Qt::SolidPattern);
435 double this_thickness =
438 double above_height = 0;
444 if (above_height > this_height) {
445 return QRectF(this_pos - this_thickness / 2., this_height, this_thickness,
446 above_height - this_height);
448 return QRectF(this_pos - this_thickness / 2., above_height, this_thickness,
449 this_height - above_height);
460 return QRectF(pos, height - thickness / 2., width, thickness);
470 scene()->addItem(segment_view);
480 if (segment_view && segment_view->scene() ==
scene())
481 scene()->removeItem(segment_view);
568 auto brush = QBrush(Qt::SolidPattern);
589 double above_height = 0;
595 return QRectF(pos - radius, above_height - radius, 2 * radius, 2 * radius);
604 return QRectF(pos - radius, height - radius, 2 * radius, 2 * radius);
614 scene()->addItem(handle_view);
624 if (handle_view && handle_view->scene() ==
scene())
625 scene()->removeItem(handle_view);
706 auto brush = QBrush();
709 pen.setStyle(Qt::PenStyle::DashLine);
721 pen.setStyle(Qt::PenStyle::SolidLine);
725 brush.setStyle(Qt::SolidPattern);
746 auto path = QPainterPath();
757 path.lineTo(pos, height);
769 auto path = QPainterPath();
795 double lower_height = 0;
800 double pos_y = (lower_height - height) / 2 + height;
802 return QRectF(pos_x -
roughness - radius, pos_y - radius, 2 * radius, 2 * radius);
814 double lower_height = 0;
819 double pos_y = (lower_height - height) / 2 + height;
821 return QRectF(pos_x +
roughness - radius, pos_y - radius, 2 * radius, 2 * radius);
839 if (handle_roughness_view)
840 scene()->addItem(handle_roughness_view);
859 if (handle_roughness_view && handle_roughness_view->scene() ==
scene())
860 scene()->removeItem(handle_roughness_view);
894 double second_width =
896 if (second_width == 0)
899 if (second_width < width)
900 width = second_width;
void unsubscribe(Callbacks::slot_t client) override
Removes given client from all subscriptions.
void setOnPropertyChange(Callbacks::item_str_t f, Callbacks::slot_t owner) override
Sets callback to be notified on item's property change.
Interface to convert coordinates of "scene" to coordinates of "widget".
The main object representing an editable/displayable/serializable entity.
ItemMapper * mapper()
Returns item mapper. Allows subscribing to various events happening to the item.
T property(const std::string &tag) const
Returns data stored in property item.
void setProperty(const std::string &tag, const T &value)
Sets value to property item.
Custom graphics scene to show QCustomPlot with additional elements on top.
ModelView::SceneAdapterInterface * sceneAdapter() const
Return the pointer of the scene adapter on request.
The handle QGraphicsViewItem on GraphicsScene.
QPointF getLastPos() const
Get the last position of the item.
Manages the whole appearance of a layer on the graphicsscene.
void updateTopSegment() const
Update the view of the top segment.
HandleElementView * firstSegmentHandle() const
Return the side Segment view.
void unsetSegmentHandles()
Unset the side segment elements.
void removeRoughnessFromScene() const
Remove the roughness view item from the scene.
QRectF leftRoughnessHandleRect() const
get the rectangle for the left roughness handles
QRectF sideSegmentRect() const
Return the side segment rectangle.
void putRoughnessOnScene() const
Put the roughnes view on the scene.
LayerElementController * layerBelow() const
Return the layer below the current one in relation.
void unsetRoughness()
Remove the roughness view element pointer.
void unsetLayerAbove(bool silent=true)
Unset the layer above the current one in relation.
std::vector< SegmentElementView * > m_segment_views
void putSegmentHandlesOnScene() const
Put the segment handles on the secene.
QRectF topSegmentRect() const
Return the top segment rectangle.
LayerElementItem * layerElementItem() const
Returns the pointer to the LayerElementItem in the model.
void setLayerBelow(LayerElementController *layer_view_controller)
Set the layer below the current one in relation.
GraphicsScene * scene() const
Return the current set scene.
std::vector< HandleElementView * > m_handle_views
RoughnessElementView * roughness() const
Return the roughness element view.
void putSegementsOnScene() const
Put segments on scene.
void removeRoughnessHandlesFromScene() const
Remove the roughness handles from the sene.
void setSampleItemId(std::string indentifier)
Set the idenfier of the sample item to report.
LayerElementController * p_controller_below
QPainterPath rightRoughnessPath() const
get the right painter path for the roughness view
void setRoughnessInLimits(double roughness, bool active=true) const
Handle the position variation of the right handle.
void rightHandleMoved() const
Handle the position variation of the right handle.
QPainterPath leftRoughnessPath() const
get the left painter path for the roughness view
SegmentElementView * topSegment() const
Return the top Segment view.
void topSegmentMoved() const
Handle the position variation of the top segment.
void setScene(GraphicsScene *scene)
Set the scene.
void setRoughness(RoughnessElementView *roughness_view)
Set the roughness element view.
void widthChanged(std::string id, double value) const
RoughnessElementView * p_roughness_view
HandleElementView * rightRoughnessHandle() const
Return the right roughness handle element view.
ModelView::SceneAdapterInterface * sceneAdapter() const
Get the scene adapter to convert to axes.
void updateSegmentHandles() const
Update the handles of the segment.
void setTopSegment(SegmentElementView *segment_view)
Set the top segment elements.
void unsetRoughnessHandles()
Remove the handle pointers.
void setSideSegment(SegmentElementView *segment_view)
Set the side segment elements.
SegmentElementView * sideSegment() const
Return the side Segment view.
void disconnectFormModel() const
Disconnect from the set item.
void setLayerAbove(LayerElementController *layer_view_controller)
Set the layer above the current one in relation.
void setSegmentHandles(HandleElementView *first_handle, HandleElementView *secondHandle)
Set the side segment elements.
void unsetSampleItemId()
Unset the sample item identifier.
void unsetTopSegment()
Unset the top segment elements.
void leftHandleMoved() const
Handle the position variation of the left handle.
void unsetSideSegment()
Unset the side segment elements.
std::string sampleItemId() const
Return the set sample item identifier.
QRectF firstSegmentHandleRect() const
Get the first segment handle rectangle.
HandleElementView * secondSegmentHandle() const
Return the top Segment view.
void sideSegmentMoved() const
Handle the position variation of the side segment.
void connectToModel() const
Connect to the set item.
void roughnessChanged(std::string id, double value) const
std::vector< HandleElementView * > m_rough_handles_views
void unsetScene()
Set the scene.
void updateSideSegment() const
Update the view of the side segment.
void removeSegmentHandlesFromScene() const
Remove the segment handles on the scene.
LayerElementController * p_controller_above
void heightChanged(std::string id, double value) const
QRectF rightRoughnessHandleRect() const
get the rectangle for the right roughness handles
QRectF secondSegmentHandleRect() const
Get the second segment handle rectangle.
LayerElementItem * p_model_item
void deleteViewItems()
If loacally created the view elements nees to be locally destroyed.
void handleViewMoved(HandleElementView *handle_view)
The move logic for the handles associated to the segments.
void segmentViewMoved(SegmentElementView *segment_view)
The move logic for the segments.
void updateRoughness() const
Update the whole roughness drawing.
void autoPopulate()
Allow the population of the own elements.
LayerElementController * layerAbove() const
Return the layer above the current one in relation.
void putRoughnessHandlesOnScene() const
Put the roughness handles on the scene.
void setRoughnessHandles(HandleElementView *first_handle_view, HandleElementView *second_handle_view)
Set the roughness handle element views.
std::string m_sample_item_id
void unsetLayerBelow(bool silent=true)
Unset the layer below the current one in relation.
void removeSegmentsFromScene() const
Remove the segments from the scene.
HandleElementView * leftRoughnessHandle() const
Return the left roughness handle element view.
The mvvm session item associated to a layer.
static const std::string P_SIDE_THICKNESS
static const std::string P_TOP_PEN_WIDTH
static const std::string P_R_HANDLE_RADIUS
static const std::string P_SIDE_BRUSH_COLOR
static const std::string P_ROUGHNESS_PEN_COLOR
static const std::string P_TOP_BRUSH_COLOR
static const std::string P_ROUGHNESS_PEN_WIDTH
static const std::string P_TOP_PEN_COLOR
static const std::string P_HEIGHT
static const std::string P_HANDLE_PEN_WIDTH
static const std::string P_TOP_THICKNESS
static const std::string P_R_HANDLE_BRUSH_COLOR
static const std::string P_SIDE_PEN_WIDTH
static const std::string P_HANDLE_RADIUS
static const std::string P_ROUGHNESS_BRUSH_COLOR
static const std::string P_WIDTH
static const std::string P_ROUGHNESS
static const std::string P_SIDE_PEN_COLOR
static const std::string P_X_POS
static const std::string P_R_HANDLE_PEN_COLOR
static const std::string P_R_HANDLE_PEN_WIDTH
static const std::string P_HANDLE_PEN_COLOR
static const std::string P_HANDLE_BRUSH_COLOR
The roughness QGraphicsViewItem.
void setRightPath(QPainterPath right_path)
Set the draw path for the right side.
void setBrush(QBrush brush)
Set the brush.
void setPen(QPen pen)
Set the pen.
void setLeftPath(QPainterPath left_path)
Set the draw path for the left side.
The segment QGraphicsViewItem on the Graphicsscene.
QPointF getLastPos() const
Get the last position of the item.
materialitems.h Collection of materials to populate MaterialModel.
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.