コード例 #1
0
ファイル: Axis.c プロジェクト: underworldcode/underworld1
void _lucAxis_AssignFromXML( void* axis, Stg_ComponentFactory* cf, void* data )
{
   lucAxis*             self               = (lucAxis*) axis;
   Name colourNameX;
   Name colourNameY;
   Name colourNameZ;

   Coord origin;

   /* Construct Parent */
   _lucDrawingObject_AssignFromXML( self, cf, data );

   colourNameX  = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colourX", "Red" ) ;
   colourNameY  = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colourY", "Green" ) ;
   colourNameZ  = Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"colourZ", "Blue" ) ;

   lucColour_FromString( &self->colours[0], colourNameX );
   lucColour_FromString( &self->colours[1], colourNameY );
   lucColour_FromString( &self->colours[2], colourNameZ );

   origin[I_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"originX", 32.0  );
   origin[J_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"originY", 32.0  );
   origin[K_AXIS]  = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"originZ", 0.25  );

   _lucAxis_Init( self,
                  origin,
                  Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"length", 0.2 ),
                  Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"axes", "xyz" ),
                  Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"labelX", "X" ),
                  Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"labelY", "Y" ),
                  Stg_ComponentFactory_GetString( cf, self->name, (Dictionary_Entry_Key)"labelZ", "Z" ),
                  self->colours[0],
                  self->colours[1],
                  self->colours[2]);
}
コード例 #2
0
void _lucIsosurface_AssignFromXML( void* drawingObject, Stg_ComponentFactory* cf, void* data )
{
   lucIsosurface*         self               = (lucIsosurface*)drawingObject;
   Index                  defaultRes;
   IJK                    resolution;
   double                 isovalue;
   lucDrawingObjectMask   mask;

   /* Construct Parent */
   _lucDrawingObject_AssignFromXML( self, cf, data );

   self->elementRes[I_AXIS] = Dictionary_GetInt( cf->rootDict, (Dictionary_Entry_Key)"elementResI"  );
   self->elementRes[J_AXIS] = Dictionary_GetInt( cf->rootDict, (Dictionary_Entry_Key)"elementResJ"  );
   self->elementRes[K_AXIS] = Dictionary_GetInt( cf->rootDict, (Dictionary_Entry_Key)"elementResK"  );

   defaultRes = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolution", 1.0);
   resolution[ I_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionX", defaultRes);
   resolution[ J_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionY", defaultRes);
   resolution[ K_AXIS ] = Stg_ComponentFactory_GetUnsignedInt( cf, self->name, (Dictionary_Entry_Key)"resolutionZ", defaultRes);

   /* Get fields */
   self->isosurfaceField = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"IsosurfaceField", FieldVariable, True, data  );
   self->colourField     = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"ColourField", FieldVariable, False, data  );
   self->maskField       = Stg_ComponentFactory_ConstructByKey( cf, self->name, (Dictionary_Entry_Key)"MaskField", FieldVariable, False, data  );

   if (defaultRes == 1 && (resolution[I_AXIS] > 2 || resolution[J_AXIS] > 2 || resolution[K_AXIS] > 2))
   {
      Journal_Printf( lucInfo, "** WARNING ** excessive isosurface resolution: samples per element reduced to 2,2,2 - was %d,%d,%d\n", resolution[I_AXIS], resolution[J_AXIS], resolution[K_AXIS]);
      resolution[I_AXIS] = resolution[J_AXIS] = resolution[K_AXIS] = 2;
   }

   lucDrawingObjectMask_Construct( &mask, self->name, cf, data );

   isovalue = Stg_ComponentFactory_GetDouble( cf, self->name, (Dictionary_Entry_Key)"isovalue", 0.0  );

   _lucIsosurface_Init(
      self,
      isovalue,
      resolution,
      Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"drawWalls", False  ),
      Stg_ComponentFactory_GetBool( cf, self->name, (Dictionary_Entry_Key)"sampleGlobal", False  ),
      &mask );
}