7 #ifndef __operate_OperatorSurfaceCommon_h__ 8 #define __operate_OperatorSurfaceCommon_h__ 29 e_point=SurfaceAccessibleI::e_point,
30 e_pointGroup=SurfaceAccessibleI::e_pointGroup,
31 e_vertex=SurfaceAccessibleI::e_vertex,
32 e_primitive=SurfaceAccessibleI::e_primitive,
33 e_primitiveGroup=SurfaceAccessibleI::e_primitiveGroup,
34 e_detail=SurfaceAccessibleI::e_detail
38 e_generic=SurfaceAccessibleI::e_generic,
39 e_position=SurfaceAccessibleI::e_position,
40 e_normal=SurfaceAccessibleI::e_normal,
41 e_uv=SurfaceAccessibleI::e_uv,
42 e_color=SurfaceAccessibleI::e_color,
43 e_vertices=SurfaceAccessibleI::e_vertices,
44 e_properties=SurfaceAccessibleI::e_properties
48 e_openCurve=SurfaceAccessibleI::e_openCurve,
49 e_countU=SurfaceAccessibleI::e_countU,
50 e_countV=SurfaceAccessibleI::e_countV,
51 e_wrappedU=SurfaceAccessibleI::e_wrappedU,
52 e_wrappedV=SurfaceAccessibleI::e_wrappedV,
53 e_depth=SurfaceAccessibleI::e_depth
57 e_quiet=SurfaceAccessibleI::e_quiet,
58 e_warning=SurfaceAccessibleI::e_warning,
59 e_error=SurfaceAccessibleI::e_error
63 e_refuseMissing=SurfaceAccessibleI::e_refuseMissing,
64 e_createMissing=SurfaceAccessibleI::e_createMissing
69 SurfaceAccessibleI::e_pointsOnly,
71 SurfaceAccessibleI::e_pointsOfPrimitives,
73 SurfaceAccessibleI::e_primitivesOnly,
74 e_primitivesWithPoints=
75 SurfaceAccessibleI::e_primitivesWithPoints
81 m_spThreadingState=
new 82 SurfaceAccessibleI::ThreadingState();
91 virtual BWORD saveState(
String& rBuffer) {
return FALSE; }
92 virtual BWORD loadState(
const String& rBuffer){
return FALSE; }
98 { m_pPlugin=a_pPlugin; }
100 void dirty(BWORD a_aggressive)
101 {
if(m_pPlugin) m_pPlugin->dirty(a_aggressive); }
103 void setSharingName(
String a_name)
104 { m_sharingName=a_name; }
106 {
return m_sharingName; }
107 void changeSharing(BWORD a_include);
108 void selectNode(
String a_selectName);
110 {
if(m_pPlugin) m_pPlugin->select(); }
112 BWORD interrupted(
void)
114 m_pPlugin->interrupted(): FALSE; }
117 Real startFrame(
Record& a_rSignal)
119 Real* pFrame=m_aStartFrame.queryAttribute(
121 return pFrame? *pFrame: -1.0;
123 Real endFrame(
Record& a_rSignal)
125 Real* pFrame=m_aEndFrame.queryAttribute(
127 return pFrame? *pFrame: -1.0;
129 Real currentFrame(
Record& a_rSignal)
131 Real* pFrame=m_aFrame.queryAttribute(a_rSignal);
132 return pFrame? *pFrame: -1.0;
134 void setCurrentFrame(
Record& a_rSignal,Real a_frame)
136 Real* pReal=m_aFrame.queryAttribute(a_rSignal);
142 Real currentTime(
Record& a_rSignal)
144 Real* pTime=m_aTime.queryAttribute(a_rSignal);
145 return pTime? *pTime: -1.0;
150 m_aSurfaceOutput.queryAttribute(
154 return *pspComponent;
158 void setSurfaceOutput(
Record& a_rSignal,
162 m_aSurfaceOutput.queryAttribute(
166 *pspComponent=a_spComponent;
172 m_aDrawOutput.queryAttribute(a_rSignal);
175 return *pspComponent;
182 m_aDrawGuide.queryAttribute(a_rSignal);
185 return *pspComponent;
192 m_aDrawBrush.queryAttribute(a_rSignal);
195 return *pspComponent;
202 .queryAttribute(a_rSignal);
205 return *pspComponent;
212 m_aCameraTransform.queryAttribute(
214 if(pSpatialTransform)
216 return *pSpatialTransform;
218 return SpatialTransform::identity();
223 m_aRayOrigin.queryAttribute(a_rSignal);
226 return *pSpatialVector;
233 m_aRayDirection.queryAttribute(
237 return *pSpatialVector;
244 Message a_message=e_error)
246 a_rspDraw=outputDraw(a_rSignal);
247 if(a_rspDraw.isValid())
251 reportDraw(
"Output",a_message);
255 Message a_message=e_error)
257 a_rspDraw=guideDraw(a_rSignal);
258 if(a_rspDraw.isValid())
262 reportDraw(
"Guide",a_message);
266 Message a_message=e_error)
268 a_rspDraw=brushDraw(a_rSignal);
269 if(a_rspDraw.isValid())
273 reportDraw(
"Brush",a_message);
276 BWORD accessBrushOverlay(
sp<DrawI>& a_rspDraw,
278 Message a_message=e_error)
280 a_rspDraw=brushOverlayDraw(a_rSignal);
281 if(a_rspDraw.isValid())
285 reportDraw(
"BrushOverlay",a_message);
290 Record& a_rSignal,Message a_message=e_error)
292 a_rspAccessible=surfaceOutput(a_rSignal);
293 if(a_rspAccessible.isValid() &&
294 a_rspAccessible->isBound())
296 a_rspAccessible->bind(m_spThreadingState);
297 m_spSurfaceOutput=a_rspAccessible;
300 a_rspAccessible=NULL;
301 reportAccessible(
"<output>",a_message);
306 Element a_element,Attribute a_attribute,
307 Message a_message=e_error,
308 Creation a_create=e_createMissing)
311 if(!accessOutput(spAccessible,
312 a_rSignal,a_message))
318 spAccessible->bind(m_spThreadingState);
319 return access(a_rspAccessor,spAccessible,
320 a_element,a_attribute,
325 Element a_element,
String a_attrName,
326 Message a_message=e_error,
327 Creation a_create=e_createMissing)
330 if(!accessOutput(spAccessible,
331 a_rSignal,a_message))
337 spAccessible->bind(m_spThreadingState);
338 return access(a_rspAccessor,spAccessible,
339 a_element,a_attrName,
345 Message a_message=e_error,
349 surfaceOutput(a_rSignal);
350 if(spAccessible.isNull())
355 spAccessible->bind(m_spThreadingState);
356 return access(a_rspSurface,spAccessible,
357 a_primitiveGroup,a_message,a_subIndex);
361 Message a_message=e_error,
364 return accessOutput(a_rspSurface,a_rSignal,
"",
365 a_message,a_subIndex);
367 virtual I32 discardPattern(
369 Element a_element,
String a_pattern)
371 return a_spAccessible->discardPattern(
372 SurfaceAccessibleI::Element(a_element),
376 Element a_element,
String a_attrName)
378 return a_spAccessible->discard(
379 SurfaceAccessibleI::Element(a_element),
383 Element a_element,Attribute a_attribute)
385 return a_spAccessible->discard(
386 SurfaceAccessibleI::Element(a_element),
387 SurfaceAccessibleI::Attribute(
390 virtual I32 deleteElements(
392 Element a_element,
String a_groupString,
393 BWORD a_retainGroups=FALSE)
395 return a_spAccessible->deleteElements(
396 SurfaceAccessibleI::Element(a_element),
397 a_groupString,a_retainGroups);
399 virtual I32 deleteElements(
401 Element a_element,std::set<I32>& a_rIntSet,
402 BWORD a_retainGroups=FALSE)
404 return a_spAccessible->deleteElements(
405 SurfaceAccessibleI::Element(a_element),
406 a_rIntSet,a_retainGroups);
412 Message a_message=e_error,
415 a_rspSurface=a_subIndex<0?
416 a_rspAccessible->surface(
418 a_rspAccessible->subSurface(
419 a_subIndex,a_primitiveGroup);
420 if(a_rspSurface.isValid())
424 reportSurface(a_rspAccessible->name(),
430 Message a_message=e_error,
433 return access(a_rspSurface,a_rspAccessible,
"",
434 a_message,a_subIndex);
438 Message a_message=e_error,
442 if(!access(spAccessible,a_key,a_message))
448 return access(a_rspSurface,spAccessible,
449 a_primitiveGroup,a_message,a_subIndex);
452 String a_key,Message a_message=e_error,
455 return access(a_rspSurface,a_key,
"",
456 a_message,a_subIndex);
459 String a_key,Message a_message=e_error)
461 a_rspAccessible=catalog< sp<Component> >(a_key);
462 if(a_rspAccessible.isValid() &&
463 a_rspAccessible->isBound())
467 a_rspAccessible=NULL;
468 reportAccessible(a_key,a_message);
474 Element a_element,Attribute a_attribute,
475 Message a_message=e_error,
476 Creation a_create=e_createMissing)
478 const BWORD writable=isOutput(a_rspAccessible);
479 a_rspAccessor=a_rspAccessible->accessor(
481 SurfaceAccessibleI::Element(a_element),
482 SurfaceAccessibleI::Attribute(
485 SurfaceAccessibleI::Creation(a_create):
486 SurfaceAccessibleI::e_refuseMissing,
488 SurfaceAccessibleI::e_readWrite:
489 SurfaceAccessibleI::e_readOnly);
490 if(a_rspAccessor.isValid())
494 const String attrName=attributeText(a_attribute);
495 reportAccessor(a_rspAccessible->name(),
496 a_element,attrName,a_message);
502 Element a_element,
String a_attrName,
503 Message a_message=e_error,
504 Creation a_create=e_createMissing)
506 const BWORD writable=isOutput(a_rspAccessible);
507 a_rspAccessor=a_rspAccessible->accessor(
509 SurfaceAccessibleI::Element(a_element),
512 SurfaceAccessibleI::Creation(a_create):
513 SurfaceAccessibleI::e_refuseMissing,
515 SurfaceAccessibleI::e_readWrite:
516 SurfaceAccessibleI::e_readOnly);
517 if(a_rspAccessor.isValid())
521 reportAccessor(a_rspAccessible->name(),
523 "\""+a_attrName+
"\"",a_message);
528 Element a_element,Attribute a_attribute,
529 Message a_message=e_error,
530 Creation a_create=e_createMissing)
532 return access(a_rspAccessor,a_rspAccessible,
533 "",a_element,a_attribute,
538 Element a_element,
String a_attrName,
539 Message a_message=e_error,
540 Creation a_create=e_createMissing)
542 return access(a_rspAccessor,a_rspAccessible,
543 "",a_element,a_attrName,
548 Element a_element,Attribute a_attribute,
549 Message a_message=e_error)
552 if(!access(spAccessible,a_key,a_message))
558 return access(a_rspAccessor,spAccessible,
559 a_element,a_attribute,
560 a_message,e_refuseMissing);
564 Element a_element,
String a_attrName,
565 Message a_message=e_error)
568 if(!access(spAccessible,a_key,a_message))
574 return access(a_rspAccessor,spAccessible,
575 a_element,a_attrName,
576 a_message,e_refuseMissing);
582 return (a_rspAccessible==m_spSurfaceOutput);
587 m_spSurfaceOutput=a_rspAccessible;
593 static String elementText(Element a_element)
605 case e_primitiveGroup:
606 return "PrimitiveGroup";
610 return "<bad element>";
613 static String elementText(SurfaceAccessibleI::Element a_element)
614 {
return elementText(Element(a_element)); }
616 static String attributeText(Attribute a_attribute)
635 return "<bad attribute>";
638 static String attributeText(
639 SurfaceAccessibleI::Attribute a_attribute)
640 {
return attributeText(Attribute(a_attribute)); }
644 BWORD determineNeighborhood(
646 Array< std::set<I32> >& a_rPointFaces,
647 Array< std::set<I32> >& a_rPointNeighbors);
651 virtual BWORD anticipate(
String a_change,
653 virtual BWORD anticipate(
String a_change)
654 {
return anticipate(a_change,
656 virtual BWORD resolve(
String a_change,
658 virtual BWORD resolve(
String a_change)
659 {
return resolve(a_change,
661 virtual BWORD resolve(
void)
663 virtual BWORD chronicle(
String a_change,
666 {
return m_pPlugin? m_pPlugin->chronicle(
667 a_change,a_spOldCounted,
668 a_spNewCounted): FALSE; }
669 virtual BWORD chronicle(
String a_change)
676 void report(
String a_text,Message a_message)
678 #if FE_CODEGEN<=FE_DEBUG 679 feLog(
"%s %s\n",name().c_str(),a_text.
c_str());
681 catalog<String>(a_message==e_error?
682 "error":
"warning")+=a_text+
"; ";
684 void reportDraw(
String a_drawName,Message a_message)
686 if(a_message==e_quiet)
691 text.
sPrintf(
"failed to access drawing" 692 " interface \"%s\"",a_drawName.
c_str());
693 report(text,a_message);
695 void reportSurface(
String a_key,Message a_message)
697 if(a_message==e_quiet)
702 text.
sPrintf(
"failed to access \"%s\"" 703 " (as searchable)",a_key.
c_str());
704 report(text,a_message);
706 void reportAccessible(
String a_key,Message a_message)
708 if(a_message==e_quiet)
713 if(a_key==
"<output>")
716 "failed to access general output");
720 text.
sPrintf(
"failed to access general" 721 " input \"%s\"",a_key.
c_str());
723 report(text,a_message);
725 void reportAccessor(
String a_key,Element a_element,
726 String a_attrName,Message a_message)
728 if(a_message==e_quiet)
732 String elementName=elementText(a_element);
734 text.
sPrintf(
"failed to access %s %s on %s",
738 (
"\""+a_key+
"\"").c_str());
739 report(text,a_message);
Common Operator/Manipulator methods.
Definition: OperateCommon.h:20
const FESTRING_I8 * c_str(void) const
Return the contents of the 8-bit buffer cast as signed bytes.
Definition: String.h:352
kernel
Definition: namespace.dox:3
Safe handle for shared pointer.
Definition: Handled.h:61
String & sPrintf(const char *fmt,...)
Populate the string in the manner of sprintf().
Definition: String.cc:529
Automatically reference-counted string container.
Definition: String.h:128
Partial Generic SurfaceI Implemention.
Definition: OperatorSurfaceCommon.h:20
Wrapper for std::vector.
Definition: Array.h:21
Reference to an instance of a Layout.
Definition: RecordSB.h:35
General Surface Manipulation.
Definition: OperatorSurfaceI.h:20
Plugin back reference for OperatorSurfaceI.
Definition: OperatorPlugin.h:20
Per-class participation non-RTTI fallback dynamic casting mechanism.
Definition: Castable.h:192