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