Salome HOME
Typo-fix by Kunda
[modules/geom.git] / src / GEOMGUI / GEOMGUI_DimensionProperty.h
index f2c5f7e58a358a3a7db31508ad9f0f3bc55116b3..a074da4940b8661932bd67c627460c3be343323b 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -42,6 +42,9 @@
 
 class SalomeApp_Study;
 
+class GEOMGUI_DimensionProperty;
+typedef QSharedPointer<GEOMGUI_DimensionProperty> DimensionPropertyPtr;
+
 /*!
  * \brief Utility class to unpack/pack dimension presentations as object property of study.
  *
@@ -53,9 +56,9 @@ class SalomeApp_Study;
  * (name);(is_visible);(dimension type);(dimension property list);
  * 
  * The following packing scheme is used to store dimension data:
- * Length: (plane)[0-3] (flyout)[4] (text flags)[5-6] (p1)[7-9] (pnt2)[10-12]
- * Diam:   (plane)[0-3] (flyout)[4] (text flags)[5-6] (circle loc, xdir, ydir, rad)[7-16]
- * Angle:               (flyout)[0] (text flags)[1-2] (p1)[3-5] (p2)[6-8] (center)[9-11]
+ * Length: (plane)[0-3] (flyout)[4] (text flags)[5-6] (arrow flag)[7] (p1)[8-10] (pnt2)[11-13]
+ * Diam:   (plane)[0-3] (flyout)[4] (text flags)[5-6] (arrow flag)[7] (circle loc, xdir, ydir, rad)[8-17]
+ * Angle:               (flyout)[0] (text flags)[1-2] (arrow flag)[3] (p1)[4-6] (p2)[7-9] (center)[10-12]
  */
 class Standard_EXPORT GEOMGUI_DimensionProperty
 {
@@ -93,6 +96,9 @@ public:
     Diameter* AsDiameter() { return static_cast<Diameter*>( this ); }
     Angle*    AsAngle()    { return static_cast<Angle*>( this ); }
 
+    virtual void ToValues(std::vector<double>& theValues) const = 0;
+    virtual void FromValues(int& theIt, const std::vector<double>& theValues) = 0;
+
   private:
     DimensionType myType;
   };
@@ -109,7 +115,8 @@ public:
       Plane( gp::XOY() ),
       Flyout( 0.0 ),
       TextHPos( Prs3d_DTHP_Fit ),
-      TextVPos( Prs3d_DTVP_Center )
+      TextVPos( Prs3d_DTVP_Center ),
+      ArrowPos( Prs3d_DAO_Fit )
       {}
 
     Length( const Length& theOther ) :
@@ -119,7 +126,8 @@ public:
       Plane( theOther.Plane ),
       Flyout( theOther.Flyout ),
       TextHPos( theOther.TextHPos ),
-      TextVPos( theOther.TextVPos )
+      TextVPos( theOther.TextVPos ),
+      ArrowPos( theOther.ArrowPos )
       {}
 
     ~Length() {}
@@ -127,19 +135,32 @@ public:
     /*!
      * \brief Inits property fields from the passed length object.
      * \param theIO [in] the interactive presentation.
-     * \param theLCS [in] the local coordiante system of parent object.
+     * \param theLCS [in] the local coordinate system of parent object.
      */
     void Init( const Handle(AIS_LengthDimension)& theIO, const gp_Ax3& theLCS );
 
     /*!
      * \brief Updates length object properties from the fields.
      * \param theIO [in/out] the interactive presentation.
-     * \param theLCS [in] the local coordiante system of parent object.
+     * \param theLCS [in] the local coordinate system of parent object.
      */
     void Update( Handle(AIS_LengthDimension)& theIO, const gp_Ax3& theLCS );
 
     /*!
-     * \brief Overload comparsion.
+     * \brief Packs properties to array of doubles.
+     * \param theValues [out] the values vector to populate.
+     */
+    void ToValues(std::vector<double>& theValues) const;
+
+    /*!
+     * \brief Unpacks properties from array of doubles.
+     * \param theIt [in/out] the array index iterator.
+     * \param theValues [in] the vector of values.
+     */
+    void FromValues(int& theIt, const std::vector<double>& theValues);
+
+    /*!
+     * \brief Overload comparison.
      */
     bool operator == (const Length &theOther) const;
     bool operator != (const Length &theOther) const { return !(operator == (theOther)); }
@@ -150,6 +171,7 @@ public:
     double Flyout;
     Prs3d_DimensionTextHorizontalPosition TextHPos;
     Prs3d_DimensionTextVerticalPosition   TextVPos;
+    Prs3d_DimensionArrowOrientation       ArrowPos;
   };
 
   /*!
@@ -162,7 +184,8 @@ public:
       Plane( gp::XOY() ),
       Flyout( 0.0 ),
       TextHPos( Prs3d_DTHP_Fit ),
-      TextVPos( Prs3d_DTVP_Center )
+      TextVPos( Prs3d_DTVP_Center ),
+      ArrowPos( Prs3d_DAO_Fit )
       {}
 
      Diameter( const Diameter& theOther ) :
@@ -171,7 +194,8 @@ public:
        Plane( theOther.Plane ),
        Flyout( theOther.Flyout ),
        TextHPos( theOther.TextHPos ),
-       TextVPos( theOther.TextVPos )
+       TextVPos( theOther.TextVPos ),
+       ArrowPos( theOther.ArrowPos )
        {}
 
     ~Diameter() {}
@@ -179,19 +203,32 @@ public:
     /*!
      * \brief Inits property fields from the passed length object.
      * \param theIO [in] the interactive presentation.
-     * \param theLCS [in] the local coordiante system of parent object.
+     * \param theLCS [in] the local coordinate system of parent object.
      */
     void Init( const Handle(AIS_DiameterDimension)& theIO, const gp_Ax3& theLCS );
 
     /*!
      * \brief Updates length object properties from the fields.
      * \param theIO [in/out] the interactive presentation.
-     * \param theLCS [in] the local coordiante system of parent object.
+     * \param theLCS [in] the local coordinate system of parent object.
      */
     void Update( Handle(AIS_DiameterDimension)& theIO, const gp_Ax3& theLCS );
 
     /*!
-     * \brief Overload comparsion.
+     * \brief Packs properties to array of doubles.
+     * \param theValues [out] the values vector to populate.
+     */
+    void ToValues(std::vector<double>& theValues) const;
+
+    /*!
+     * \brief Unpacks properties from array of doubles.
+     * \param theIt [in/out] the array index iterator.
+     * \param theValues [in] the vector of values.
+     */
+    void FromValues(int& theIt, const std::vector<double>& theValues);
+
+    /*!
+     * \brief Overload comparison.
      */
     bool operator == (const Diameter &theOther) const;
     bool operator != (const Diameter &theOther) const { return !(operator == (theOther)); }
@@ -201,6 +238,7 @@ public:
     double Flyout;
     Prs3d_DimensionTextHorizontalPosition TextHPos;
     Prs3d_DimensionTextVerticalPosition   TextVPos;
+    Prs3d_DimensionArrowOrientation       ArrowPos;
   };
 
   /*!
@@ -215,7 +253,8 @@ public:
       CenterPoint( gp::Origin() ),
       Flyout( 0.0 ),
       TextHPos( Prs3d_DTHP_Fit ),
-      TextVPos( Prs3d_DTVP_Center )
+      TextVPos( Prs3d_DTVP_Center ),
+      ArrowPos( Prs3d_DAO_Fit )
       {}
 
     Angle( const Angle& theOther ) :
@@ -225,7 +264,8 @@ public:
       CenterPoint( theOther.CenterPoint ),
       Flyout( theOther.Flyout ),
       TextHPos( theOther.TextHPos ),
-      TextVPos( theOther.TextVPos )
+      TextVPos( theOther.TextVPos ),
+      ArrowPos( theOther.ArrowPos )
       {}
 
     ~Angle() {}
@@ -233,19 +273,32 @@ public:
     /*!
      * \brief Inits property fields from the passed length object.
      * \param theIO [in] the interactive presentation.
-     * \param theLCS [in] the local coordiante system of parent object.
+     * \param theLCS [in] the local coordinate system of parent object.
      */
     void Init( const Handle(AIS_AngleDimension)& theIO, const gp_Ax3& theLCS );
 
     /*!
      * \brief Updates length object properties from the fields.
      * \param theIO [in/out] the interactive presentation.
-     * \param theLCS [in] the local coordiante system of parent object.
+     * \param theLCS [in] the local coordinate system of parent object.
      */
     void Update( Handle(AIS_AngleDimension)& theIO, const gp_Ax3& theLCS );
 
     /*!
-     * \brief Overload comparsion.
+     * \brief Packs properties to array of doubles.
+     * \param theValues [out] the values vector to populate.
+     */
+    void ToValues(std::vector<double>& theValues) const;
+
+    /*!
+     * \brief Unpacks properties from array of doubles.
+     * \param theIt [in/out] the array index iterator.
+     * \param theValues [in] the vector of values.
+     */
+    void FromValues(int& theIt, const std::vector<double>& theValues);
+
+    /*!
+     * \brief Overload comparison.
      */
     bool operator == (const Angle &theOther) const;
     bool operator != (const Angle &theOther) const { return !(operator == (theOther)); }
@@ -256,6 +309,7 @@ public:
     double Flyout;
     Prs3d_DimensionTextHorizontalPosition TextHPos;
     Prs3d_DimensionTextVerticalPosition   TextVPos;
+    Prs3d_DimensionArrowOrientation       ArrowPos;
   };
 
   typedef QSharedPointer<Record> RecordPtr;
@@ -272,6 +326,16 @@ public:
    */
   GEOMGUI_DimensionProperty( const GEOMGUI_DimensionProperty& theOther );
 
+   /*!
+   * \brief Constructor. Inits property from attribute.
+   */
+  GEOMGUI_DimensionProperty( SalomeApp_Study* theStudy, const std::string& theEntry );
+
+   /*!
+   * \brief Constructor. Inits property from formatted QString.
+   */
+  GEOMGUI_DimensionProperty( const QString& theProperty );
+
   /*!
    * \brief Destructor.
    */
@@ -280,13 +344,26 @@ public:
   /*!
    * \brief Overload QVariant cast operator.
    */
-  operator QVariant();
+  operator QVariant() const;
 
   /*!
-   * \brief Overload comparsion.
+   * \brief Overload QString cast operator.
+   */
+  operator QString() const;
+
+  /*!
+   * \brief Overload comparison.
    */
   bool operator == (const GEOMGUI_DimensionProperty &theOther) const;
 
+  /*!
+   * \brief Overload comparison.
+   */
+  bool operator != (const GEOMGUI_DimensionProperty &theOther) const
+  {
+    return !(operator == (theOther));
+  }
+
 public:
 
   /*!