Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:16

0001 // Created on: 2003-10-13
0002 // Created by: Alexander SOLOVYOV
0003 // Copyright (c) 2003-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _MeshVS_VectorPrsBuilder_HeaderFile
0017 #define _MeshVS_VectorPrsBuilder_HeaderFile
0018 
0019 #include <MeshVS_DataMapOfIntegerVector.hxx>
0020 #include <MeshVS_PrsBuilder.hxx>
0021 #include <MeshVS_DisplayModeFlags.hxx>
0022 #include <MeshVS_BuilderPriority.hxx>
0023 #include <TColgp_Array1OfPnt.hxx>
0024 
0025 class MeshVS_Mesh;
0026 class Quantity_Color;
0027 class MeshVS_DataSource;
0028 class gp_Trsf;
0029 class Graphic3d_ArrayOfPrimitives;
0030 class gp_Vec;
0031 
0032 DEFINE_STANDARD_HANDLE(MeshVS_VectorPrsBuilder, MeshVS_PrsBuilder)
0033 
0034 //! This class provides methods to create vector data presentation.
0035 //! It store map of vectors assigned with nodes or elements.
0036 //! In simplified mode vectors draws with thickened ends instead of arrows
0037 class MeshVS_VectorPrsBuilder : public MeshVS_PrsBuilder
0038 {
0039 
0040 public:
0041 
0042   
0043   Standard_EXPORT MeshVS_VectorPrsBuilder(const Handle(MeshVS_Mesh)& Parent, const Standard_Real MaxLength, const Quantity_Color& VectorColor, const MeshVS_DisplayModeFlags& Flags = MeshVS_DMF_VectorDataPrs, const Handle(MeshVS_DataSource)& DS = 0, const Standard_Integer Id = -1, const MeshVS_BuilderPriority& Priority = MeshVS_BP_Vector, const Standard_Boolean IsSimplePrs = Standard_False);
0044   
0045   //! Builds vector data presentation
0046   Standard_EXPORT virtual void Build (const Handle(Prs3d_Presentation)& Prs, const TColStd_PackedMapOfInteger& IDs, TColStd_PackedMapOfInteger& IDsToExclude, const Standard_Boolean IsElement, const Standard_Integer theDisplayMode) const Standard_OVERRIDE;
0047   
0048   //! Adds to array of polygons and polylines some primitive representing single vector
0049   Standard_EXPORT void DrawVector (const gp_Trsf& theTrsf, const Standard_Real Length, const Standard_Real MaxLength, const TColgp_Array1OfPnt& ArrowPoints, const Handle(Graphic3d_ArrayOfPrimitives)& Lines, const Handle(Graphic3d_ArrayOfPrimitives)& ArrowLines, const Handle(Graphic3d_ArrayOfPrimitives)& Triangles) const;
0050   
0051   //! Calculates points of arrow presentation
0052   Standard_EXPORT static Standard_Real calculateArrow (TColgp_Array1OfPnt& Points, const Standard_Real Length, const Standard_Real ArrowPart);
0053   
0054   //! Returns map of vectors assigned with nodes or elements
0055   Standard_EXPORT const MeshVS_DataMapOfIntegerVector& GetVectors (const Standard_Boolean IsElement) const;
0056   
0057   //! Sets map of vectors assigned with nodes or elements
0058   Standard_EXPORT void SetVectors (const Standard_Boolean IsElement, const MeshVS_DataMapOfIntegerVector& Map);
0059   
0060   //! Returns true, if map isn't empty
0061   Standard_EXPORT Standard_Boolean HasVectors (const Standard_Boolean IsElement) const;
0062   
0063   //! Returns vector assigned with certain node or element
0064   Standard_EXPORT Standard_Boolean GetVector (const Standard_Boolean IsElement, const Standard_Integer ID, gp_Vec& Vect) const;
0065   
0066   //! Sets vector assigned with certain node or element
0067   Standard_EXPORT void SetVector (const Standard_Boolean IsElement, const Standard_Integer ID, const gp_Vec& Vect);
0068   
0069   //! Calculates minimal and maximal length of vectors in map
0070   //! ( nodal, if IsElement = False or elemental, if IsElement = True )
0071   Standard_EXPORT void GetMinMaxVectorValue (const Standard_Boolean IsElement, Standard_Real& MinValue, Standard_Real& MaxValue) const;
0072   
0073   //! Sets flag that indicates is simple vector arrow mode uses or not
0074   //! default value is False
0075   Standard_EXPORT void SetSimplePrsMode (const Standard_Boolean IsSimpleArrow);
0076   
0077   //! Sets parameters of simple vector arrwo presentation
0078   //! theLineWidthParam - coefficient of vector line width (to draw line instead of arrow)
0079   //! theStartParam and theEndParam parameters of start and end of thickened ends
0080   //! position of thickening calculates according to parameters and maximum vector length
0081   //! default values are:
0082   //! theLineWidthParam = 2.5
0083   //! theStartParam     = 0.85
0084   //! theEndParam       = 0.95
0085   Standard_EXPORT void SetSimplePrsParams (const Standard_Real theLineWidthParam, const Standard_Real theStartParam, const Standard_Real theEndParam);
0086 
0087 
0088 
0089 
0090   DEFINE_STANDARD_RTTIEXT(MeshVS_VectorPrsBuilder,MeshVS_PrsBuilder)
0091 
0092 protected:
0093 
0094 
0095 
0096 
0097 private:
0098 
0099 
0100   Standard_Boolean myIsSimplePrs;
0101   Standard_Real mySimpleWidthPrm;
0102   Standard_Real mySimpleStartPrm;
0103   Standard_Real mySimpleEndPrm;
0104   MeshVS_DataMapOfIntegerVector myNodeVectorMap;
0105   MeshVS_DataMapOfIntegerVector myElemVectorMap;
0106 
0107 
0108 };
0109 
0110 
0111 
0112 
0113 
0114 
0115 
0116 #endif // _MeshVS_VectorPrsBuilder_HeaderFile