Draw a bounding box for a Grid object residing in the fiber bundle.
Draw a bounding box for a Grid object residing in the fiber bundle.Refinement representations and field fragments are supported (which constitutes AMR).
For each coordinate field, the bounding box is stored with the field and thus re-used if possible. Also, there might be an field in the same data represention be specified. The bounding box information of this field is then shown in addition. This field may consist of various fragments, such that multiple bounding boxes are shown. The bounding box information is cached at each field fragment.
If values in field coordinates are changed, this is not recognized. Code doing so would have to clear the field's FragmentBoxes interface.
#include <bone/BundleInput.hpp>
#include <bone/GridObject.hpp>
#include <bone/FishField.hpp>
#include <bone/FieldObject.hpp>
#include <ocean/shrimp/Options.hpp>
#include <ocean/shrimp/VObjectStatus.hpp>
#include <ocean/GLvish/BoundingBox.hpp>
#include <ocean/GLvish/GLFonts.hpp>
#include <ocean/Anemonia/FloatOrigin.hpp>
#include <eagle/PhysicalSpace.hpp>
#include <eye/retina/VFieldRenderObject.hpp>
#include <baseop/ExpandBBox.hpp>
namespace
{
, public Fish<Fiber::Skeleton>
{
public:
enum { NumberOfInputFields = 1 };
{
double MinBBoxRadius, MaxBBoxRadius;
struct PerFragmentInfo
{
{}
};
void clear()
{
}
};
{
return new FieldState();
}
inUnloadedColor,
inFontColor;
inFontScale;
, inOptions(
this,
"options",
Options(
"+autoscale +showtext"))
, inColor(
this,
"color",
rgba_float_t(0.4, 0.12, 0.65, 1.0), 1)
, inUnloadedColor(
this,
"uncolor",
rgba_float_t(0.3, 0.3, 0.3, 1.0), 2)
, inFontColor(
this,
"fontcolor",
rgba_float_t(0.9, 0.9, 0.9, 1.0), 1)
, Thickness(this, "thickness", 20, 5.0)
, inFontScale(this, "fontscale", 1.0, 1)
{}
bool update(
VRequest&R,
double precision)
override;
};
{
if (!CurrentCoords)
{
printf("bool VFragmentBoxes::FieldState::apply(const RefPtr<FragmentID>&, CreativeArrayBase&): NO COORDINATES!\n" );
return false;
}
{
double R = BBox->getRadius();
if (BBoxes.size()<1)
{
MinBBoxRadius = MaxBBoxRadius = R;
}
else
{
if (R<MinBBoxRadius) MinBBoxRadius = R;
if (R>MaxBBoxRadius) MaxBBoxRadius = R;
}
BBoxes.push_back( PerFragmentInfo(BBox,
);
FieldBBox->insert( *BBox );
}
return true;
}
{
{
string Fieldname;
{}
{
{
cout <<
"VFragmentBoxes::DataExtractor::apply() No CartesianLevelRep found!! Skipping fragment!" <<
endl;
return true;
}
S->CurrentCoords = Coords;
{
DataField->iterate( *S );
}
return true;
}
}
DE.S->FieldBBox->updateBall();
if (ConnectionAge().isYoungerThan( inFontScale->ValueAge(
Context) ) )
{
double R =
DE.S->FieldBBox->getRadius();
inFontScale.setProperty("max", R);
}
{
}
if (
DE.FieldInstancesFound)
{
return StatusIndicator::setStatusInfo(
Context,
"Showing " + String(
int(
DE.S->BBoxes.size() ) ) +
" fragment boxes for "
+ String(
DE.FieldInstancesFound ) +
" field instances. "
"Bounding box radii vary from " + String(
DE.S->MinBBoxRadius) +
" to " + String(
DE.S->MaxBBoxRadius) +
" ."
);
}
else
{
return setStatusError(
Context,
"No instances of the given field \"" +
DE.Fieldname +
"\" found.");
}
}
{
if (!myState)
return false;
Eagle::tvector3 TranslationVector;
auto T = getCoordinateTranslation(
Context, TranslationVector);
double width = 20;
if (width<=0.0)
width = 1.0;
#if 0
#endif
if( MyFont) MyFont->setSize(1);
double FontScale = 0.5;
for(unsigned i=0; i<myState->BBoxes.size(); i++)
{
if (!myState->BBoxes[ i ].BBox )
continue;
if (myState->BBoxes[i].DataPtr &&
myState->BBoxes[i].DataPtr->hasData() )
{
}
else
if (
opt(
"showtext") && FontScale>0.0 && MyFont && myState->BBoxes[i].fragID)
{
glTranslate(
CurrentBBox.center() - TranslationVector );
glScaled(FontScale, FontScale, FontScale );
MyFont->render( myState->BBoxes[i].fragID->Name().c_str() );
}
}
return true;
}
ObjectQuality::EXPERIMENTAL );
}
_Expr< _ValFunClos< _ValArray, _Tp >, _Tp > apply(_Tp __func(_Tp)) const
basic_ostream< _CharT, _Traits > & endl(basic_ostream< _CharT, _Traits > &__os)
constexpr void clear() noexcept
An iterator with an optional DataCreator, which is just a class to intercept creation of data along a...
Definition CreativeIterator.hpp:34
Base class for iterators over the fragments of a field.
Definition FragmentID.hpp:249
Base class for objects rendering fields on a fiber bundle.
Definition VFieldRenderObject.hpp:23
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 ...
Definition GridInspector.hpp:13