Free Electron
OperateCommon.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __operate_OperateCommon_h__
8 #define __operate_OperateCommon_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /**************************************************************************//**
16  @brief Common Operator/Manipulator methods
17 
18  @ingroup operate
19 *//***************************************************************************/
20 class FE_DL_EXPORT OperateCommon:
21  public Catalog,
22  virtual public HandlerI
23 {
24  public:
25  enum CurveMode
26  {
27  e_null,
28  e_lines,
29  e_panels,
30  e_cylinders,
31  e_tube
32  };
33 
34  class Edge
35  {
36  public:
37  Edge(void):
38  m_count(0) {}
39 
40  SpatialVector m_pointA;
41  SpatialVector m_pointB;
42  SpatialVector m_normal0;
43  SpatialVector m_normal1;
44  String m_part0;
45  String m_part1;
46  I32 m_count;
47  };
48 
49  OperateCommon(void) {}
50 virtual ~OperateCommon(void) {}
51 
52  //* As HandlerI
53 virtual void handleBind(sp<SignalerI> a_spSignalerI,
54  sp<Layout> a_spLayout);
55 
56  Record windowEvent(Record& a_rSignal)
57  {
58  Record* pRecord=
59  m_aWindowEvent.queryAttribute(
60  a_rSignal);
61  if(pRecord)
62  {
63  return *pRecord;
64  }
65  return Record();
66  }
67 
68 static void drawLabel(sp<DrawI> a_spDrawI,
69  const SpatialVector& a_location,
70  String a_label,
71  BWORD a_centered,
72  U32 a_margin,
73  const Color a_textColor,
74  const Color* a_pBorderColor,
75  const Color* a_pBackground);
76 static void drawIndicator(sp<DrawI> a_spDrawI,Box2i& a_box,
77  BWORD a_vertical,BWORD a_reverse,
78  Real a_value,Real a_loopValue,Real a_grain,
79  I32 a_precision,
80  I32 a_minChars,I32 a_maxChars,
81  Real a_multiplication,
82  const Color* a_pBrightColor,
83  const Color* a_pDimColor,
84  const Color* a_pBackground,
85  const Color* a_pOdometerBG);
86 static void drawOdometer(sp<DrawI> a_spDrawI,
87  SpatialVector a_location,
88  Real a_value,I32 a_precision,
89  I32 a_minChars,I32 a_maxChars,
90  BWORD a_centered,U32 a_margin,
91  const Color a_textColor,
92  const Color* a_pBorderColor,
93  const Color* a_pBackground);
94 static void drawPicker(sp<DrawI> a_spDrawI,
95  const SpatialVector& a_point,
96  const SpatialVector& a_up,
97  const SpatialVector& a_normal,
98  Real a_scale,I32 a_depth,
99  const Color* a_pColor);
100 static void drawImpact(sp<DrawI> a_spDrawI,
101  sp<SurfaceTriangles::Impact> a_spTriImpact,
102  Real a_inset,const Color* a_pColor);
103 static void drawInsetTriangle(sp<DrawI> a_spDrawI,
104  const SpatialVector& a_vertex0,
105  const SpatialVector& a_vertex1,
106  const SpatialVector& a_vertex2,
107  Real a_inset,const Color* a_pColor);
108 static void highlightCurve(sp<ViewI> a_spView,
109  sp<DrawI> a_spDraw,
110  sp<SurfaceAccessorI> a_spVertices,
111  I32 a_primitiveIndex,I32 a_vertexIndex,
112  const Color* a_pLineColor,
113  const Color* a_pPointColor,
114  const Color* a_pPointHighlight);
115 static void drawDot(sp<ViewI> a_spView,sp<DrawI> a_spDraw,
116  SpatialVector a_point,Real a_radius,
117  const Color a_color);
118 static void drawSquare(sp<DrawI>& a_rspDraw,
119  const SpatialVector& a_rPoint,
120  Real a_rimSize,BWORD a_bevel,
121  const Color& a_rColorCenter,
122  const Color& a_rColorRim,
123  const Color* a_pColorShadow,
124  const Color* a_pColorSparkle);
125 static void drawTube(sp<DrawI>& a_rspDraw,
126  const SpatialVector* a_point,
127  const SpatialVector* a_normal,
128  const Real* a_radius,
129  U32 a_pointCount,CurveMode a_curveMode,
130  BWORD a_multicolor,const Color *a_color,
131  const SpatialVector& a_rTowardCamera);
132 static void drawTubeAxes(sp<DrawI>& a_rspDraw,
133  const SpatialTransform& a_transform,
134  Real a_scale,Real a_alpha,
135  const Array<Real>& a_profile,
136  CurveMode a_curveMode);
137 static void drawAnchor(sp<DrawI>& a_rspDraw,
138  SpatialTransform a_transform,
139  Real a_scale,U32 a_resolution,
140  Color a_color);
141 static void drawCrossSection(sp<DrawI>& a_rspDraw,
142  SpatialVector a_p0,
143  SpatialVector a_p1,
144  SpatialVector a_p2,
145  SpatialVector a_planeCenter,
146  SpatialVector a_planeNormal,
147  Color a_color);
148 static void drawCrossSection(sp<DrawI>& a_rspDraw,
149  sp<SurfaceAccessorI> a_spVertices,
150  SpatialVector a_planeCenter,
151  SpatialVector a_planeNormal,
152  Color a_color);
153 static void drawOutline(sp<DrawI> a_spDrawI,
155  a_spSurfaceAccessibleI,
156  String a_partAttr,String a_partName,
157  SpatialVector a_cameraPos,Color a_color);
158 static void createEdges(
160  a_spSurfaceAccessibleI,
161  String a_partAttr,
162  std::map<U64,Edge>& a_rEdgeMap);
163 static void drawOutline(sp<DrawI> a_spDrawI,
164  std::map<U64,Edge>& a_rEdgeMap,
165  String a_partName,
166  SpatialVector a_cameraPos,Color a_color);
167 
168 static I32 nearestPointIndex(
170  a_spPrimitiveVertices,
172  a_rspCurveImpact);
173 
174 static I32 nearestTriVertexIndex(
176  a_rspTriImpact);
177 static I32 nearestPointIndex(sp<SurfaceTriangles::Impact>&
178  a_rspTriImpact);
179 static SpatialVector nearestVertexPoint(sp<SurfaceTriangles::Impact>&
180  a_rspTriImpact);
181 
182 static Real nearestPointAlongCurve(const SpatialVector a_point,
184  a_spPrimitiveVertices,
185  const I32 a_primitiveIndex);
186 
187 static Real fractionAtLength(
189  a_spPrimitiveVertices,
190  const I32 a_primitiveIndex,
191  Real a_length);
192 static Real lengthAtFraction(
194  a_spPrimitiveVertices,
195  const I32 a_primitiveIndex,
196  Real a_fraction);
197 static SpatialVector evaluateAtFraction(
199  a_spPrimitiveVertices,
200  const I32 a_primitiveIndex,
201  Real a_fraction,U32 a_derivitive);
202 
203 static Real flameProfile(Real a_peakOffset,Real a_fraction);
204 
205  private:
206 
207  Accessor<Record> m_aWindowEvent;
208 };
209 
210 } /* namespace ext */
211 } /* namespace fe */
212 
213 #endif /* __operate_OperateCommon_h__ */
Common Operator/Manipulator methods.
Definition: OperateCommon.h:20
kernel
Definition: namespace.dox:3
Dictionary of Arbitrary Instances.
Definition: Catalog.h:24
The main data access class for the data system.
Definition: Accessor.h:128
Special vector for color (RGBA)
Definition: Color.h:21
Interface to handle signals from an SignalerI.
Definition: HandlerI.h:22
Automatically reference-counted string container.
Definition: String.h:128
Reference to an instance of a Layout.
Definition: RecordSB.h:35