From 9f17be8af02011f04d188ce991921f6eb0ecf792 Mon Sep 17 00:00:00 2001 From: Thales1330 Date: Wed, 25 Jan 2017 19:45:45 -0200 Subject: Several graphic tools implemented, tf start --- Project/Element.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Project/Element.h') diff --git a/Project/Element.h b/Project/Element.h index 8a9f56f..d3a733d 100644 --- a/Project/Element.h +++ b/Project/Element.h @@ -594,6 +594,8 @@ protected: wxPoint2DDouble m_movePos; bool m_online = true; + + OpenGLColour m_selectionColour; }; #endif // ELEMENT_H -- cgit From a54f50d0bf86c7c4d400e8b4d30cbc6091cfd9df Mon Sep 17 00:00:00 2001 From: Thales1330 Date: Fri, 24 Feb 2017 12:25:41 -0300 Subject: Connection line implementation start --- Project/Element.h | 70 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 31 deletions(-) (limited to 'Project/Element.h') diff --git a/Project/Element.h b/Project/Element.h index d3a733d..c2ce506 100644 --- a/Project/Element.h +++ b/Project/Element.h @@ -230,7 +230,7 @@ public: * @param parent Element parent. * @param position Node position in the parent. */ - virtual bool AddParent(Element* parent, wxPoint2DDouble position) = 0; + virtual bool AddParent(Element* parent, wxPoint2DDouble position) { return false; } /** * @brief Checks if the element contains a position. @@ -380,29 +380,29 @@ public: * @return True if the element constains the pickbox, false otherwise. */ virtual bool PickboxContains(wxPoint2DDouble position) { return false; } - + /** * @brief Move the pickbox. * @param position position that the pickbox will be moved. */ virtual void MovePickbox(wxPoint2DDouble position) {} - + /** * @brief Get the best cursor to shown to the user when the mouse is above a pickbox. * @return Cursor. */ virtual wxCursor GetBestPickboxCursor() const { return wxCURSOR_ARROW; } - + /** * @brief Remove the pickboxes. */ virtual void ResetPickboxes() { m_activePickboxID = ID_PB_NONE; } - + /** * @brief Remove the active nodes. */ virtual void ResetNodes() { m_activeNodeID = 0; } - + /** * @brief Convert the element position to screen position. * @param translation System translation. @@ -412,7 +412,7 @@ public: */ virtual wxPoint2DDouble WorldToScreen(wxPoint2DDouble translation, double scale, double offsetX = 0.0, double offsetY = 0.0) const; - + /** * @brief Convert a generic position to screen position. * @param position Position to be converted. @@ -427,15 +427,15 @@ public: double offsetX = 0.0, double offsetY = 0.0) const; virtual bool - - /** - * @brief Check if two roteted rectangles intersect. - * @param rect1 First rect. - * @param rect2 Second rect. - * @param angle1 Rotation algle of first rectangle. - * @param angle2 Rotation angle of second rectangle. - */ - RotatedRectanglesIntersects(wxRect2DDouble rect1, wxRect2DDouble rect2, double angle1, double angle2) const; + + /** + * @brief Check if two roteted rectangles intersect. + * @param rect1 First rect. + * @param rect2 Second rect. + * @param angle1 Rotation algle of first rectangle. + * @param angle2 Rotation angle of second rectangle. + */ + RotatedRectanglesIntersects(wxRect2DDouble rect1, wxRect2DDouble rect2, double angle1, double angle2) const; /** * @brief Draw a circle. @@ -451,7 +451,7 @@ public: double finalAngle, int numSegments, GLenum mode = GL_LINE_LOOP) const; - + /** * @brief Draw rectangle. * @param position Rectangle position. @@ -460,41 +460,41 @@ public: * @param mode OpenGl primitive. */ virtual void DrawRectangle(wxPoint2DDouble position, double width, double height, GLenum mode = GL_QUADS) const; - + /** * @brief Draw rectangle. * @param points Rectangle vertices. * @param mode OpenGl primitive. */ virtual void DrawRectangle(wxPoint2DDouble* points, GLenum mode = GL_QUADS) const; - + /** * @brief Draw a triangle. * @param points Triangle vertices. * @param mode OpenGl primitive. */ virtual void DrawTriangle(std::vector points, GLenum mode = GL_TRIANGLES) const; - + /** * @brief Draw a point. * @param position Point position. * @param size Point size. */ virtual void DrawPoint(wxPoint2DDouble position, double size) const; - + /** * @brief Draw line. * @param points Line vertices. * @param mode OpenGl primitive. */ virtual void DrawLine(std::vector points, GLenum mode = GL_LINE_STRIP) const; - + /** * @brief Draw pickbox. * @param position Pickbox position. */ virtual void DrawPickbox(wxPoint2DDouble position) const; - + /** * @brief Rotate a point as element position being the origin. * @param pointToRotate Point that will be rotated. @@ -508,16 +508,16 @@ public: * @return Parent list. */ virtual std::vector GetParentList() const { return m_parentList; } - + /** * @brief Get the Child list. * @return Child List. */ virtual std::vector GetChildList() const { return m_childList; } - - //virtual wxPoint2DDouble GetMoveStartPosition() const { return m_moveStartPt; } - //virtual wxPoint2DDouble GetMovePosition() const { return m_movePos; } - + + // virtual wxPoint2DDouble GetMoveStartPosition() const { return m_moveStartPt; } + // virtual wxPoint2DDouble GetMovePosition() const { return m_movePos; } + /** * @brief Calculate the element boundaries. * @param leftUp Top-left position of the element. @@ -538,7 +538,7 @@ public: * @return True if the form is shown, false otherwise. */ virtual bool ShowForm(wxWindow* parent, Element* element) { return false; } - + /** * @brief Get a double value from a string. Show a error message if the conversion fail. * @param parent Message box parent. @@ -547,7 +547,7 @@ public: * @param errorMsg Error message. */ bool DoubleFromString(wxWindow* parent, wxString strValue, double& value, wxString errorMsg); - + /** * @brief Convert a string to int. Show a error message if the conversion fail. * @param parent Message box parent. @@ -563,6 +563,14 @@ public: * @param minDecimal Minimum number of decimal places. */ static wxString StringFromDouble(double value, int minDecimal = 1); + + /** + * @brief Calculate the distance between a line (formed by point list) and a point. + * @param point origin point. + * @param segmentNumber Sotores the segment number clicked + * @return The distance between the point and the line. + */ + virtual double PointToLineDistance(wxPoint2DDouble point, int* segmentNumber = NULL) const; protected: int m_elementID = 0; @@ -594,7 +602,7 @@ protected: wxPoint2DDouble m_movePos; bool m_online = true; - + OpenGLColour m_selectionColour; }; -- cgit From 4ddc7be64451db873e49169e951532ce8893e359 Mon Sep 17 00:00:00 2001 From: Thales1330 Date: Fri, 3 Mar 2017 18:50:40 -0300 Subject: More connection line methods implemented --- Project/Element.h | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'Project/Element.h') diff --git a/Project/Element.h b/Project/Element.h index c2ce506..bd34f5c 100644 --- a/Project/Element.h +++ b/Project/Element.h @@ -225,13 +225,20 @@ public: virtual std::vector GetPointList() const { return m_pointList; } /** - * @brief Add a parent to the element. The parent must be a bus. The element basic points are calculated in this - * method, so apply this when the element is being inserted. + * @brief Add a parent to the element. This method must be used on power elements that connect to a bus, so the + * parent must be a bus. + * The element basic points are calculated in this method, so apply this when the element is being inserted. * @param parent Element parent. * @param position Node position in the parent. */ virtual bool AddParent(Element* parent, wxPoint2DDouble position) { return false; } + /** + * @brief Add a parent to the element. + * @param parent Element parent. + */ + virtual void AddParent(Element* parent) { m_parentList.push_back(parent); } + /** * @brief Checks if the element contains a position. * @param position Position to be checked. @@ -426,16 +433,16 @@ public: double scale, double offsetX = 0.0, double offsetY = 0.0) const; - virtual bool - /** - * @brief Check if two roteted rectangles intersect. - * @param rect1 First rect. - * @param rect2 Second rect. - * @param angle1 Rotation algle of first rectangle. - * @param angle2 Rotation angle of second rectangle. - */ - RotatedRectanglesIntersects(wxRect2DDouble rect1, wxRect2DDouble rect2, double angle1, double angle2) const; + /** + * @brief Check if two roteted rectangles intersect. + * @param rect1 First rect. + * @param rect2 Second rect. + * @param angle1 Rotation algle of first rectangle. + * @param angle2 Rotation angle of second rectangle. + */ + virtual bool + RotatedRectanglesIntersects(wxRect2DDouble rect1, wxRect2DDouble rect2, double angle1, double angle2) const; /** * @brief Draw a circle. @@ -563,7 +570,7 @@ public: * @param minDecimal Minimum number of decimal places. */ static wxString StringFromDouble(double value, int minDecimal = 1); - + /** * @brief Calculate the distance between a line (formed by point list) and a point. * @param point origin point. -- cgit From ed36957d2d06ce9484e39be699bc41b521bdb090 Mon Sep 17 00:00:00 2001 From: Thales Lima Oliveira Date: Thu, 6 Apr 2017 17:12:09 -0300 Subject: Io form under implementation --- Project/Element.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Project/Element.h') diff --git a/Project/Element.h b/Project/Element.h index bd34f5c..4935f11 100644 --- a/Project/Element.h +++ b/Project/Element.h @@ -9,7 +9,7 @@ #include -#include +//#include /** * @enum PickboxID -- cgit