00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __GU_BreakpointSelection_h__
00026 #define __GU_BreakpointSelection_h__
00027
00028 #include "GU_API.h"
00029 #include <GB/GB_BreakpointGroup.h>
00030 #include "GU_Selection.h"
00031
00032 #define GU_breakpointSelectName "selectedBreakpoints"
00033 class GEO_Curve;
00034 class GEO_TPSurf;
00035
00036 class GU_API GU_BreakpointSelection : public GU_Selection
00037 {
00038 public:
00039
00040
00041 GU_BreakpointSelection(GU_Detail &gdp, const char *prefix = 0);
00042 virtual ~GU_BreakpointSelection(void);
00043
00044
00045
00046 virtual GU_Selection &operator=(GU_PointSelection &);
00047 virtual GU_Selection &operator=(GU_PrimSelection &);
00048 virtual GU_Selection &operator=(GU_EdgeSelection &);
00049 virtual GU_Selection &operator=(GU_BreakpointSelection &);
00050 virtual GU_Selection &operator=(GU_VertexSelection &);
00051 virtual GU_Selection &operator=(GU_PointGroupSelection &s)
00052 { return GU_Selection::operator=(s); }
00053 virtual GU_Selection &operator=(GU_PrimGroupSelection &s)
00054 { return GU_Selection::operator=(s); }
00055
00056
00057
00058 virtual int pickMask(void) const;
00059
00060
00061
00062 static int breakpointPickMask(void);
00063
00064
00065
00066
00067
00068 virtual int selfSnapMask(void) const;
00069
00070
00071
00072
00073
00074 virtual int select(uint *pickbuf, long npicked,
00075 void *&added,
00076 GU_SelectionRule rule = GU_AddSelect,
00077 unsigned *pickid = 0,
00078 GU_LassoInfo *linfo = 0,
00079 const UT_IntArray *prfx = 0);
00080 virtual int selectEntireGeometry(uint *pickbuf,
00081 long npicked,
00082 void *&added,
00083 GU_SelectionRule rule = GU_AddSelect,
00084 unsigned *pickid = 0,
00085 GU_LassoInfo *linfo = 0,
00086 const UT_IntArray *prfx = 0);
00087
00088 virtual int selectNext(void *&added,
00089 GU_SelectionRule rule = GU_AddSelect,
00090 int shiftstate = 0,
00091 int vstate = 0);
00092
00093 virtual int selectPrev(void *&added,
00094 GU_SelectionRule rule = GU_AddSelect,
00095 int shiftstate = 0,
00096 int vstate = 0);
00097
00098
00099
00100
00101
00102 virtual GU_SelectionResult selectEmpty(uint *pickbuf, long npicked,
00103 GU_SelectionRule rule = GU_AddSelect,
00104 unsigned *pickid = 0,
00105 GU_LassoInfo *linfo = 0,
00106 const UT_IntArray *prfx = 0) const;
00107
00108
00109
00110
00111 virtual void *siftThrough(uint *pickbuf, long npicked,
00112 int look_for_existing = 1,
00113 unsigned *pickid = 0,
00114 GU_LassoInfo *linfo = 0,
00115 const UT_IntArray *prfx = 0) const;
00116
00117
00118
00119
00120
00121
00122
00123
00124 virtual int selectionPoint(void *added, unsigned *pickid,
00125 UT_Vector3 &xsect) const;
00126 virtual int selectionPoint(void *added, unsigned *pickid,
00127 UT_Vector3 rayorig,
00128 UT_Vector3 &raydir,
00129 UT_Vector3 &xsect,
00130 int &normal,
00131 UT_Vector3 &vector,
00132 int accurate, float *u,
00133 float *v) const;
00134
00135
00136
00137
00138
00139 virtual int selectGroup(const GB_BaseGroup &group, int ref=0);
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149 virtual int add(GEO_Point &point, int = 0);
00150 virtual int add(GEO_Primitive &prim, int = 0);
00151 virtual int add(GB_Edge &edge, int = 0);
00152 virtual int add(GEO_Breakpoint &bkp, int = 0);
00153 virtual int add(GB_VertexData &vtx, int = 0);
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163 virtual int remove(GEO_Point &point, int = 0);
00164 virtual int remove(GEO_Primitive &prim, int = 0);
00165 virtual int remove(GB_Edge &edge, int = 0);
00166 virtual int remove(GEO_Breakpoint &bkp, int = 0);
00167 virtual int remove(GB_VertexData &vtx, int = 0);
00168
00169
00170
00171 virtual int removeLast(void);
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181 virtual int toggle(GEO_Point &point, int = 0);
00182 virtual int toggle(GEO_Primitive &prim, int = 0);
00183 virtual int toggle(GB_Edge &edge, int = 0);
00184 virtual int toggle(GEO_Breakpoint &bkp, int = 0);
00185 virtual int toggle(GB_VertexData &vtx, int = 0);
00186
00187
00188
00189
00190
00191
00192 virtual GB_PointGroup *updatePoints(void);
00193 virtual GB_PrimitiveGroup *updatePrimitives(void);
00194 virtual void updateStashed(void);
00195
00196
00197
00198 virtual void clear(void);
00199 virtual void clearAndDestroy(void);
00200
00201
00202
00203 virtual int destroyGeometry(void);
00204
00205
00206
00207 virtual int copyGeometry(int copies = 1, UT_Vector3 *delta = 0,
00208 const char *groupname = 0);
00209
00210
00211
00212
00213 GEO_Breakpoint *find(const GEO_Breakpoint &b) const;
00214
00215
00216 virtual int entries(void) const;
00217
00218
00219
00220 virtual int getBoundingBox(UT_BoundingBox &bbox) const;
00221 virtual int getBoundingBox(UT_BoundingBox &bbox, const UT_Matrix4& transform ) const;
00222
00223
00224
00225 virtual int getBoundingBoxUV(UT_BoundingBox &bbox,
00226 const char *name,
00227 int isvertex) const;
00228
00229
00230 const UT_LinkList &getSelection(void) const { return theSelection.list(); }
00231
00232
00233 virtual int save(ostream &os, int binary) const;
00234 virtual bool load(UT_IStream &is);
00235
00236
00237 virtual GU_Detail *createGeometry();
00238
00239
00240 virtual int classType(void) const;
00241
00242
00243 virtual const GB_BreakpointGroup *breakpoints(void) const;
00244
00245 protected:
00246
00247 virtual GU_Selection *newSpecies(GU_Detail &gdp);
00248
00249
00250
00251
00252 int findFirstBreakpoint(GEO_Primitive &prim, GEO_Breakpoint &bkp,
00253 int &ubcount, int &uvcount,
00254 int direction);
00255
00256 int getEndBreakpoint(GEO_Primitive &prim, GEO_Breakpoint &bkp,
00257 int &ubcount, int &uvcount,
00258 int direction);
00259
00260 int getNextBreakpoint(GEO_Primitive &prim, GEO_Breakpoint &bkp,
00261 int ubcount, int vbcount, int direction);
00262
00263
00264 virtual const GB_BaseGroup *mainGroup() const { return &theSelection; }
00265
00266 protected:
00267
00268 GU_BreakpointSelection(GU_Detail &gdp, const GU_BreakpointSelection &s);
00269
00270
00271 virtual int selectAllUsingClosure(
00272 GU_PrimGroupClosure *closure,
00273 int how_to_treat_closure);
00274 virtual int toggleAllUsingClosure(GU_PrimGroupClosure *closure,
00275 int how_to_treat_closure);
00276
00277 int addPrimBreakpoints (GEO_Primitive &prim);
00278 int removePrimBreakpoints(GEO_Primitive &prim);
00279 int togglePrimBreakpoints(GEO_Primitive &prim);
00280
00281 int addCurveBreakpoints(GEO_Curve *curve,
00282 int vindex);
00283 int addSurfaceBreakpoints(GEO_TPSurf *surf,
00284 int row, int col);
00285
00286 void translateCurve(GEO_Curve *curve,
00287 const UT_Vector3 &delta);
00288 void translateSurface(GEO_TPSurf *surf,
00289 const UT_Vector3 &delta);
00290 void transformCurve(GEO_Curve *curve,
00291 const UT_Matrix4 &matx);
00292 void transformSurface(GEO_TPSurf *surf,
00293 const UT_Matrix4 &matx);
00294
00295 GB_BreakpointGroup theSelection;
00296 };
00297
00298 #endif