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 #include <GA/GA_PrimCompat.h>
00027
00028 #define GU_primSelectName "selectedPrims"
00029
00030
00031 class GU_API GU_PrimSelection : public GU_Selection
00032 {
00033 public:
00034
00035
00036
00037
00038 GU_PrimSelection(GU_Detail &gdp, const char *grpname = "_gu_pmselection_",
00039 int reset = 0, const char *prefix = 0);
00040 GU_PrimSelection(GU_Detail &gdp, GA_PrimitiveGroup &ptgroup,
00041 const char *prefix = 0);
00042 virtual ~GU_PrimSelection(void);
00043
00044
00045
00046
00047 void useGroup(GA_PrimitiveGroup &group,
00048 int ref = 0);
00049
00050
00051
00052 virtual GU_Selection &operator=(GU_PointSelection &);
00053 virtual GU_Selection &operator=(GU_PrimSelection &);
00054 virtual GU_Selection &operator=(GU_EdgeSelection &);
00055 virtual GU_Selection &operator=(GU_BreakpointSelection &);
00056 virtual GU_Selection &operator=(GU_VertexSelection &);
00057 virtual GU_Selection &operator=(GU_PointGroupSelection &s)
00058 { return GU_Selection::operator=(s); }
00059 virtual GU_Selection &operator=(GU_PrimGroupSelection &s)
00060 { return GU_Selection::operator=(s); }
00061
00062 virtual GU_PrimSelection &operator|=(GA_PrimitiveGroup &group);
00063 virtual GU_PrimSelection &operator-=(GA_PrimitiveGroup &group);
00064 virtual GU_PrimSelection &operator&=(GA_PrimitiveGroup &group);
00065 virtual GU_PrimSelection &operator^=(GA_PrimitiveGroup &group);
00066
00067
00068
00069 virtual int pickMask(void) const;
00070
00071
00072
00073 static int primitivePickMask(void);
00074
00075
00076
00077
00078
00079 virtual int selfSnapMask(void) const;
00080
00081
00082
00083
00084
00085 virtual int select(uint *pickbuf, long npicked,
00086 GU_SelectResult &added,
00087 GU_SelectionRule rule = GU_AddSelect,
00088 unsigned *pickid = 0,
00089 GU_LassoInfo *linfo = 0,
00090 const UT_IntArray *prfx = 0);
00091 virtual int selectEntireGeometry(uint *pickbuf,
00092 long npicked,
00093 GU_SelectResult &added,
00094 GU_SelectionRule rule = GU_AddSelect,
00095 unsigned *pickid = 0,
00096 GU_LassoInfo *linfo = 0,
00097 const UT_IntArray *prfx = 0);
00098
00099 virtual int selectBoundary(bool checkuv);
00100 virtual int shrinkSelection(bool checkuv);
00101
00102
00103
00104
00105 virtual int selectNext(GU_SelectResult &added,
00106 GU_SelectionRule rule= GU_AddSelect,
00107 int shiftstate = 0,
00108 int vstate = 0);
00109
00110 virtual int selectPrev(GU_SelectResult &added,
00111 GU_SelectionRule rule= 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 bool siftThrough(GU_SelectResult &result,
00129 uint *pickbuf, long npicked,
00130 int look_for_existing = 1,
00131 unsigned *pickid = 0,
00132 GU_LassoInfo *linfo = 0,
00133 const UT_IntArray *prfx = 0) const;
00134
00135
00136
00137
00138
00139
00140
00141
00142 virtual int selectionPoint(const GU_SelectResult &added,
00143 unsigned *pickid,
00144 UT_Vector3 &xsect) const;
00145 virtual int selectionPoint(const GU_SelectResult &added,
00146 unsigned *pickid,
00147 UT_Vector3 rayorig,
00148 UT_Vector3 &raydir,
00149 UT_Vector3 &xsect,
00150 int &normal,
00151 UT_Vector3 &vector,
00152 int accurate, float *u,
00153 float *v) const;
00154
00155
00156
00157
00158
00159 virtual int selectGroup(const GA_Group &group, int ref=0);
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169 virtual int add(const GEO_Point &point, int ordered=0);
00170 virtual int add(const GEO_Primitive &prim, int ordered=0);
00171 virtual int add(const GA_Edge &edge, int ordered=0);
00172 virtual int add(const GA_Edge &edge, GEO_Primitive &,
00173 int ordered=0)
00174 { return add(edge, ordered); }
00175 virtual int add(const GA_Breakpoint &bkp, int otdered=0);
00176 virtual int add(const GEO_Vertex &vtx, int otdered=0);
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186 virtual int remove(const GEO_Point &point, int ordered=0);
00187 virtual int remove(const GEO_Primitive &prim, int ordered=0);
00188 virtual int remove(const GA_Edge &edge, int ordered=0);
00189 virtual int remove(const GA_Edge &edge, GEO_Primitive &,
00190 int ordered=0)
00191 { return remove(edge, ordered); }
00192 virtual int remove(const GA_Breakpoint &bkp, int ordered=0);
00193 virtual int remove(const GEO_Vertex &vtx, int ordered=0);
00194
00195
00196
00197 virtual int removeLast(void);
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207 virtual int toggle(const GEO_Point &point, int ordered=0);
00208 virtual int toggle(const GEO_Primitive &prim, int ordered=0);
00209 virtual int toggle(const GA_Edge &edge, int ordered=0);
00210 virtual int toggle(const GA_Edge &edge, GEO_Primitive &,
00211 int ordered=0)
00212 { return toggle(edge, ordered); }
00213 virtual int toggle(const GA_Breakpoint &bkp, int ordered=0);
00214 virtual int toggle(const GEO_Vertex &vtx, int ordered=0);
00215
00216
00217
00218
00219
00220
00221
00222
00223 virtual GA_PointGroup *updatePoints(void);
00224 virtual GA_PrimitiveGroup *updatePrimitives(void);
00225 virtual void updateStashed(void);
00226
00227
00228
00229
00230 virtual int applyStashed(void);
00231
00232
00233 const GA_PrimitiveGroup *selection(void) const
00234 {
00235 return theSelection;
00236 }
00237
00238
00239
00240
00241
00242 int filterPrimitives(
00243 const GA_PrimCompat::TypeMask &primmask,
00244 int inOut=1);
00245
00246
00247
00248 virtual void clear(void);
00249 virtual void clearAndDestroy(void);
00250
00251
00252
00253 virtual int destroyGeometry(void);
00254
00255
00256
00257 virtual int copyGeometry(int copies = 1, UT_Vector3 *delta = 0,
00258 const char *groupname = 0);
00259
00260
00261 virtual void reverse();
00262
00263
00264 virtual int entries(void) const;
00265
00266
00267
00268 virtual int getBoundingBox(UT_BoundingBox &bbox) const;
00269 virtual int getBoundingBox(UT_BoundingBox &bbox,
00270 const UT_Matrix4R &transform) const;
00271
00272
00273
00274 virtual int getBoundingBoxUV(UT_BoundingBox &bbox,
00275 const char *name,
00276 int isvertex) const;
00277
00278
00279 virtual GU_Detail *createGeometry();
00280
00281
00282 virtual int classType(void) const;
00283
00284
00285 virtual GU_Selection *newSpecies(GU_Detail &gdp);
00286
00287 protected:
00288
00289
00290 GU_PrimSelection(GU_Detail &gdp, const GU_PrimSelection &s);
00291
00292
00293
00294 virtual int selectAllUsingClosure(
00295 GU_PrimGroupClosure *closure,
00296 int how_to_treat_closure);
00297 virtual int toggleAllUsingClosure(GU_PrimGroupClosure *closure,
00298 int how_to_treat_closure);
00299
00300 GA_PrimitiveGroup *theSelection;
00301
00302 virtual const GA_Group *mainGroup() const { return theSelection; }
00303
00304 int isPrimInLasso(const GEO_Primitive *prim,
00305 GU_LassoInfo *linfo,
00306 GU_PolyRaster *&praster) const;
00307
00308
00309 private:
00310 void clearGroup();
00311
00312 short theOwnFlag;
00313 };
00314
00315 #endif