FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
GridActor.hpp
1#ifndef __FISH_BONE_GRIDACTOR_HPP
2#define __FISH_BONE_GRIDACTOR_HPP
3
4#include <ocean/plankton/VPipeline.hpp>
5
6#include <bundle/GridSelector.hpp>
7#include <bundle/BundleProperty.hpp>
8
9#include "Fish.hpp"
10
11namespace Wizt
12{
13
14
93template <class GridInspector, class CreativeObject = void>
94struct GridActor : VCreator<CreativeObject, AcceptList<Fiber::Grid> >
95{
97
101 GridActor(const std::string&name, int quality,
102 const RefPtr<VCreationPreferences>&VP=nullptr,
105 {}
106
110 template <unsigned ID>
116
117
123 {
124#ifdef VERBOSE_GRIDACTOR
125 printf("----> GridActor::accept() %s looking at %s\n",
126 Typename(typeid(CreativeObject)).c_str(), vobj->Name().c_str() override;
127#endif
129
130 /*POSSIBLE PROBLEM:
131 Could have multiple grid selectors in vobj, thus
132 should rather iterate over them than getting the first one here.
133 */
134 RefPtr<VParameter> GPar = vobj -> getImplementation( typeid(Fiber::GridSelector) );
135 if (!GPar)
136 return VAcceptInfoList_t();
137
139 if (!GPar->getValue( GS, nullptr, "") )
140 return VAcceptInfoList_t();
141
143
144 if (!GS.BundleSource() )
145 {
146 //
147 // source object exports a GridSelector,
148 // but has no bundle object yet.
149 // Probably this means that it wants to export
150 // a Grid, but its creation has not yet been triggered.
151 // Thus, allow accepting this object, such that
152 // this rendering object may trigger the creation of
153 // an appropriate Grid.
154 //
155#ifdef VERBOSE_GRIDACTOR
156 printf("GRIDACTOR: NO BUNDLE YET in [%s] -> [%s] - allowing all output objects. "
157 "If that is not desirable, object should output an empty bundle.\n",
158 vobj->Name().c_str(), GPar->Name().c_str()
159 );
160#endif
161 return Base_t::accept(vobj)*0.5 & "There is no Bundle yet on the given Grid, this output "
162 "might be possible, but not necessarily suitable.";
163 }
164
165// if (hasProperty(GS, GridInspector::InspectionProperty() ) )
166
168
169 if (GS.hasProperty(GridInspector::InspectionProperty() ) )
170 {
171#ifdef VERBOSE_GRIDACTOR
172 puts("OUTPUT BUNDLE HAS REQUESTED PROPERTY - output object permitted");
173#endif
175 return Base_t::accept(vobj)*2.0 &
176 "The suggested output is suitable to the properties of the given Grid.";
177 }
179
180 return VAcceptInfoList_t();
181 }
182};
183
185template <class CreativeObject>
204
205
221template <class GridFunctionObject>
222struct VSink<Fiber::Grid, GridFunctionObject> : OmegaRef<GridActor<GridFunctionObject> >
223{
225 VSink(const string&name, int p = ObjectQuality::EXPERIMENTAL, const RefPtr<VCreationPreferences>&Prep = nullptr )
227 {}
228
230 template <unsigned ID>
233 {}
234};
235
236
237template <class GridFunctionObject, class OutputObject>
238struct VFilter<Fiber::Grid, GridFunctionObject, OutputObject> : OmegaRef<VInputCreator<OutputObject, GridActor<GridFunctionObject> > >
239{
241 VFilter(const string&name, int p = ObjectQuality::EXPERIMENTAL, const RefPtr<VCreationPreferences>&Prep = nullptr )
243 {}
244
246 template <unsigned ID>
249 {}
250};
251
252
253
254template <class GridFunctionObject, class OutputObject>
255struct VPipeline<Fiber::Grid, GridFunctionObject, OutputObject> : VFilter<Fiber::Grid, GridFunctionObject, OutputObject>
256{
258 VPipeline(const string&name, int p = ObjectQuality::EXPERIMENTAL, const RefPtr<VCreationPreferences>&Prep = nullptr )
260 {}
261
263 template <unsigned ID>
266 {}
267};
268
269template <class GridFunctionObject>
270struct VPipeline<Fiber::Grid, GridFunctionObject, void> : VFilter<Fiber::Grid, GridFunctionObject, void>
271{
273 VPipeline(const string&name, int p = ObjectQuality::EXPERIMENTAL, const RefPtr<VCreationPreferences>&Prep = nullptr )
275 {}
276
278 template <unsigned ID>
281 {}
282};
283
284
285} // namespace Wizt
286
287#endif /* __FISH_BONE_GRIDACTOR_HPP */
basic_string< char > string
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
Context information to select a grid from within a bundle.
Definition GridSelector.hpp:26
const Fiber::BundlePtr & BundleSource() const
Provide the original bundle of from where the Grid was selected.
Definition GridSelector.hpp:109
bool hasProperty(const BundleProperty &theProperty) const
Check this GridSelector for a certain property.
Definition GridSelector.hpp:251
A Grid is a set of Skeleton objects, each of them accessed via some unique SkeletonID object.
Definition Grid.hpp:60
const T & getValue(index_t i) const
Get the value, readonly.
Definition vector/Iterator.hpp:718
VAcceptInfoList_t accept(const RefPtr< VObject > &vobj) const override
MEMCORE_API std::string Typename(const std::type_info &t)
Given a fragmented field of curvilinear coordinates, (3D array of coordinates), build a uniform Grid ...
Definition FAQ.dox:2
note: cannot derive from FloatingSkeletonRenderer as long as independent base class TriangleRenderer ...
std::list< RefPtr< VAcceptInfo > > VAcceptInfoList_t
Creator for objects operating on certain kinds of Grid objects, providing an interface for the functi...
Definition GridActor.hpp:95
GridActor(const VCreatorProperty< ID > &CreatorProperties, int quality, const RefPtr< VCreationPreferences > &VP=nullptr, const char *const CreatorReleaseIdentifier=VISH_INPUT_CREATOR_RELEASE_IDENTIFIER)
Construct grid actor from creation properties.
Definition GridActor.hpp:111
GridActor(const std::string &name, int quality, const RefPtr< VCreationPreferences > &VP=nullptr, const char *const CreatorReleaseIdentifier=VISH_INPUT_CREATOR_RELEASE_IDENTIFIER)
Construct grid actor from name and quality description.
Definition GridActor.hpp:101
VAcceptInfoList_t accept(const RefPtr< VObject > &vobj) const override
Acceptance function: check whether a grid exists with a Skeleton of type (1,1) (dimensionality one,...
Definition GridActor.hpp:122