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