Exemplo n.º 1
0
std::string
PyAxesArray_ToString(const AxesArray *atts, const char *prefix)
{
    std::string str; 
    char tmpStr[1000]; 

    if(atts->GetVisible())
        SNPRINTF(tmpStr, 1000, "%svisible = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%svisible = 0\n", prefix);
    str += tmpStr;
    if(atts->GetTicksVisible())
        SNPRINTF(tmpStr, 1000, "%sticksVisible = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%sticksVisible = 0\n", prefix);
    str += tmpStr;
    if(atts->GetAutoSetTicks())
        SNPRINTF(tmpStr, 1000, "%sautoSetTicks = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%sautoSetTicks = 0\n", prefix);
    str += tmpStr;
    if(atts->GetAutoSetScaling())
        SNPRINTF(tmpStr, 1000, "%sautoSetScaling = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%sautoSetScaling = 0\n", prefix);
    str += tmpStr;
    SNPRINTF(tmpStr, 1000, "%slineWidth = %d\n", prefix, atts->GetLineWidth());
    str += tmpStr;
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "axes.";
        str += PyAxisAttributes_ToString(&atts->GetAxes(), objPrefix.c_str());
    }
    return str;
}
Exemplo n.º 2
0
std::string
PyAxisTitles_ToString(const AxisTitles *atts, const char *prefix)
{
    std::string str;
    char tmpStr[1000];

    if(atts->GetVisible())
        SNPRINTF(tmpStr, 1000, "%svisible = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%svisible = 0\n", prefix);
    str += tmpStr;
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "font.";
        str += PyFontAttributes_ToString(&atts->GetFont(), objPrefix.c_str());
    }
    if(atts->GetUserTitle())
        SNPRINTF(tmpStr, 1000, "%suserTitle = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%suserTitle = 0\n", prefix);
    str += tmpStr;
    if(atts->GetUserUnits())
        SNPRINTF(tmpStr, 1000, "%suserUnits = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%suserUnits = 0\n", prefix);
    str += tmpStr;
    SNPRINTF(tmpStr, 1000, "%stitle = \"%s\"\n", prefix, atts->GetTitle().c_str());
    str += tmpStr;
    SNPRINTF(tmpStr, 1000, "%sunits = \"%s\"\n", prefix, atts->GetUnits().c_str());
    str += tmpStr;
    return str;
}
Exemplo n.º 3
0
std::string
PyColorControlPointList_ToString(const ColorControlPointList *atts, const char *prefix)
{
    std::string str;
    char tmpStr[1000];

    { // new scope
        int index = 0;
        // Create string representation of controlPoints from atts.
        for(AttributeGroupVector::const_iterator pos = atts->GetControlPoints().begin(); pos != atts->GetControlPoints().end(); ++pos, ++index)
        {
            const ColorControlPoint *current = (const ColorControlPoint *)(*pos);
            SNPRINTF(tmpStr, 1000, "GetControlPoints(%d).", index);
            std::string objPrefix(prefix + std::string(tmpStr));
            str += PyColorControlPoint_ToString(current, objPrefix.c_str());
        }
        if(index == 0)
            str += "#controlPoints does not contain any ColorControlPoint objects.\n";
    }
    const char *smoothing_names = "None, Linear, CubicSpline";
    switch (atts->GetSmoothing())
    {
      case ColorControlPointList::None:
          SNPRINTF(tmpStr, 1000, "%ssmoothing = %sNone  # %s\n", prefix, prefix, smoothing_names);
          str += tmpStr;
          break;
      case ColorControlPointList::Linear:
          SNPRINTF(tmpStr, 1000, "%ssmoothing = %sLinear  # %s\n", prefix, prefix, smoothing_names);
          str += tmpStr;
          break;
      case ColorControlPointList::CubicSpline:
          SNPRINTF(tmpStr, 1000, "%ssmoothing = %sCubicSpline  # %s\n", prefix, prefix, smoothing_names);
          str += tmpStr;
          break;
      default:
          break;
    }

    if(atts->GetEqualSpacingFlag())
        SNPRINTF(tmpStr, 1000, "%sequalSpacingFlag = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%sequalSpacingFlag = 0\n", prefix);
    str += tmpStr;
    if(atts->GetDiscreteFlag())
        SNPRINTF(tmpStr, 1000, "%sdiscreteFlag = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%sdiscreteFlag = 0\n", prefix);
    str += tmpStr;
    SNPRINTF(tmpStr, 1000, "%scategoryName = \"%s\"\n", prefix, atts->GetCategoryName().c_str());
    str += tmpStr;
    return str;
}
Exemplo n.º 4
0
std::string
PySelectionList_ToString(const SelectionList *atts, const char *prefix)
{
    std::string str;
    char tmpStr[1000];

    if(atts->GetAutoApplyUpdates())
        SNPRINTF(tmpStr, 1000, "%sautoApplyUpdates = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%sautoApplyUpdates = 0\n", prefix);
    str += tmpStr;
    { // new scope
        int index = 0;
        // Create string representation of selections from atts.
        for(AttributeGroupVector::const_iterator pos = atts->GetSelections().begin(); pos != atts->GetSelections().end(); ++pos, ++index)
        {
            const SelectionProperties *current = (const SelectionProperties *)(*pos);
            SNPRINTF(tmpStr, 1000, "GetSelections(%d).", index);
            std::string objPrefix(prefix + std::string(tmpStr));
            str += PySelectionProperties_ToString(current, objPrefix.c_str());
        }
        if(index == 0)
            str += "#selections does not contain any SelectionProperties objects.\n";
    }
    { // new scope
        int index = 0;
        // Create string representation of selectionSummary from atts.
        for(AttributeGroupVector::const_iterator pos = atts->GetSelectionSummary().begin(); pos != atts->GetSelectionSummary().end(); ++pos, ++index)
        {
            const SelectionSummary *current = (const SelectionSummary *)(*pos);
            SNPRINTF(tmpStr, 1000, "GetSelectionSummary(%d).", index);
            std::string objPrefix(prefix + std::string(tmpStr));
            str += PySelectionSummary_ToString(current, objPrefix.c_str());
        }
        if(index == 0)
            str += "#selectionSummary does not contain any SelectionSummary objects.\n";
    }
    return str;
}
Exemplo n.º 5
0
int main(int argc, char** argv)
{
    Ice::ObjectPtr viewerPtr;
    //signal(SIGINT,signalHandler);
    Ice::CommunicatorPtr ic;
    try{
        ic = EasyIce::initialize(argc, argv);

        Ice::PropertiesPtr prop = ic->getProperties();
        std::string Endpoints = prop->getProperty("Visualization.Endpoints");

        // Naming Service
        int nsActive = prop->getPropertyAsIntWithDefault("NamingService.Enabled", 0);

        if (nsActive)
        {
            std::string ns_proxy = prop->getProperty("NamingService.Proxy");
            try
            {
                namingService = new jderobot::ns(ic, ns_proxy);
            }
            catch (Ice::ConnectionRefusedException& ex)
            {
                jderobot::Logger::getInstance()->error("Impossible to connect with NameService!");
                exit(-1);
            }
        }

        Ice::ObjectAdapterPtr adapter =ic->createObjectAdapterWithEndpoints("Visualization", Endpoints);
        std::string objPrefix("Visualization.");
        std::string viewerName = prop->getProperty(objPrefix + "Name");
        Ice::ObjectPtr object = new visualization::VisualizationI(objPrefix, ic);

        adapter->add(object, ic->stringToIdentity(viewerName));

        if (namingService)
            namingService->bind(viewerName, Endpoints, object->ice_staticId());


        adapter->activate();
        ic->waitForShutdown();

    }catch (const Ice::Exception& ex) {
        std::cerr << ex<<" 1 " << std::endl;
        exit(-1);
    } catch (const char* msg) {
        std::cerr << msg<< " 2 " << std::endl;
        exit(-1);
    }

}
Exemplo n.º 6
0
std::string
PyExportDBAttributes_ToString(const ExportDBAttributes *atts, const char *prefix)
{
    std::string str;
    char tmpStr[1000];

    if(atts->GetAllTimes())
        SNPRINTF(tmpStr, 1000, "%sallTimes = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%sallTimes = 0\n", prefix);
    str += tmpStr;
    SNPRINTF(tmpStr, 1000, "%sdb_type = \"%s\"\n", prefix, atts->GetDb_type().c_str());
    str += tmpStr;
    SNPRINTF(tmpStr, 1000, "%sdb_type_fullname = \"%s\"\n", prefix, atts->GetDb_type_fullname().c_str());
    str += tmpStr;
    SNPRINTF(tmpStr, 1000, "%sfilename = \"%s\"\n", prefix, atts->GetFilename().c_str());
    str += tmpStr;
    SNPRINTF(tmpStr, 1000, "%sdirname = \"%s\"\n", prefix, atts->GetDirname().c_str());
    str += tmpStr;
    {   const stringVector &variables = atts->GetVariables();
        SNPRINTF(tmpStr, 1000, "%svariables = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < variables.size(); ++i)
        {
            SNPRINTF(tmpStr, 1000, "\"%s\"", variables[i].c_str());
            str += tmpStr;
            if(i < variables.size() - 1)
            {
                SNPRINTF(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        SNPRINTF(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    if(atts->GetWriteUsingGroups())
        SNPRINTF(tmpStr, 1000, "%swriteUsingGroups = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%swriteUsingGroups = 0\n", prefix);
    str += tmpStr;
    SNPRINTF(tmpStr, 1000, "%sgroupSize = %d\n", prefix, atts->GetGroupSize());
    str += tmpStr;
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "opts.";
        str += PyDBOptionsAttributes_ToString(&atts->GetOpts(), objPrefix.c_str());
    }
    return str;
}
std::string
PyColorTableAttributes_ToString(const ColorTableAttributes *atts, const char *prefix)
{
    std::string str;
    char tmpStr[1000];

    {   const stringVector &names = atts->GetNames();
        SNPRINTF(tmpStr, 1000, "%snames = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < names.size(); ++i)
        {
            SNPRINTF(tmpStr, 1000, "\"%s\"", names[i].c_str());
            str += tmpStr;
            if(i < names.size() - 1)
            {
                SNPRINTF(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        SNPRINTF(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    { // new scope
        int index = 0;
        // Create string representation of colorTables from atts.
        for(AttributeGroupVector::const_iterator pos = atts->GetColorTables().begin(); pos != atts->GetColorTables().end(); ++pos, ++index)
        {
            const ColorControlPointList *current = (const ColorControlPointList *)(*pos);
            SNPRINTF(tmpStr, 1000, "GetColorTables(%d).", index);
            std::string objPrefix(prefix + std::string(tmpStr));
            str += PyColorControlPointList_ToString(current, objPrefix.c_str());
        }
        if(index == 0)
            str += "#colorTables does not contain any ColorControlPointList objects.\n";
    }
    SNPRINTF(tmpStr, 1000, "%sactiveContinuous = \"%s\"\n", prefix, atts->GetActiveContinuous().c_str());
    str += tmpStr;
    SNPRINTF(tmpStr, 1000, "%sactiveDiscrete = \"%s\"\n", prefix, atts->GetActiveDiscrete().c_str());
    str += tmpStr;
    if(atts->GetGroupingFlag())
        SNPRINTF(tmpStr, 1000, "%sgroupingFlag = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%sgroupingFlag = 0\n", prefix);
    str += tmpStr;
    return str;
}
Exemplo n.º 8
0
std::string
PyExpressionList_ToString(const ExpressionList *atts, const char *prefix)
{
    std::string str; 
    char tmpStr[1000]; 

    { // new scope
        int index = 0;
        // Create string representation of expressions from atts.
        for(AttributeGroupVector::const_iterator pos = atts->GetExpressions().begin(); pos != atts->GetExpressions().end(); ++pos, ++index)
        {
            const Expression *current = (const Expression *)(*pos);
            SNPRINTF(tmpStr, 1000, "GetExpressions(%d).", index);
            std::string objPrefix(prefix + std::string(tmpStr));
            str += PyExpression_ToString(current, objPrefix.c_str());
        }
        if(index == 0)
            str += "#expressions does not contain any Expression objects.\n";
    }
    return str;
}
std::string
PySaveSubWindowsAttributes_ToString(const SaveSubWindowsAttributes *atts, const char *prefix)
{
    std::string str;
    char tmpStr[1000];

    // To squelch a warning
    (void)tmpStr;
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "win1.";
        str += PySaveSubWindowAttributes_ToString(&atts->GetWin1(), objPrefix.c_str());
    }
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "win2.";
        str += PySaveSubWindowAttributes_ToString(&atts->GetWin2(), objPrefix.c_str());
    }
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "win3.";
        str += PySaveSubWindowAttributes_ToString(&atts->GetWin3(), objPrefix.c_str());
    }
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "win4.";
        str += PySaveSubWindowAttributes_ToString(&atts->GetWin4(), objPrefix.c_str());
    }
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "win5.";
        str += PySaveSubWindowAttributes_ToString(&atts->GetWin5(), objPrefix.c_str());
    }
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "win6.";
        str += PySaveSubWindowAttributes_ToString(&atts->GetWin6(), objPrefix.c_str());
    }
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "win7.";
        str += PySaveSubWindowAttributes_ToString(&atts->GetWin7(), objPrefix.c_str());
    }
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "win8.";
        str += PySaveSubWindowAttributes_ToString(&atts->GetWin8(), objPrefix.c_str());
    }
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "win9.";
        str += PySaveSubWindowAttributes_ToString(&atts->GetWin9(), objPrefix.c_str());
    }
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "win10.";
        str += PySaveSubWindowAttributes_ToString(&atts->GetWin10(), objPrefix.c_str());
    }
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "win11.";
        str += PySaveSubWindowAttributes_ToString(&atts->GetWin11(), objPrefix.c_str());
    }
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "win12.";
        str += PySaveSubWindowAttributes_ToString(&atts->GetWin12(), objPrefix.c_str());
    }
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "win13.";
        str += PySaveSubWindowAttributes_ToString(&atts->GetWin13(), objPrefix.c_str());
    }
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "win14.";
        str += PySaveSubWindowAttributes_ToString(&atts->GetWin14(), objPrefix.c_str());
    }
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "win15.";
        str += PySaveSubWindowAttributes_ToString(&atts->GetWin15(), objPrefix.c_str());
    }
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "win16.";
        str += PySaveSubWindowAttributes_ToString(&atts->GetWin16(), objPrefix.c_str());
    }
    return str;
}
Exemplo n.º 10
0
std::string
PyAxes3D_ToString(const Axes3D *atts, const char *prefix)
{
    std::string str; 
    char tmpStr[1000]; 

    if(atts->GetVisible())
        SNPRINTF(tmpStr, 1000, "%svisible = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%svisible = 0\n", prefix);
    str += tmpStr;
    if(atts->GetAutoSetTicks())
        SNPRINTF(tmpStr, 1000, "%sautoSetTicks = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%sautoSetTicks = 0\n", prefix);
    str += tmpStr;
    if(atts->GetAutoSetScaling())
        SNPRINTF(tmpStr, 1000, "%sautoSetScaling = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%sautoSetScaling = 0\n", prefix);
    str += tmpStr;
    SNPRINTF(tmpStr, 1000, "%slineWidth = %d\n", prefix, atts->GetLineWidth());
    str += tmpStr;
    const char *tickLocation_names = "Inside, Outside, Both";
    switch (atts->GetTickLocation())
    {
      case Axes3D::Inside:
          SNPRINTF(tmpStr, 1000, "%stickLocation = %sInside  # %s\n", prefix, prefix, tickLocation_names);
          str += tmpStr;
          break;
      case Axes3D::Outside:
          SNPRINTF(tmpStr, 1000, "%stickLocation = %sOutside  # %s\n", prefix, prefix, tickLocation_names);
          str += tmpStr;
          break;
      case Axes3D::Both:
          SNPRINTF(tmpStr, 1000, "%stickLocation = %sBoth  # %s\n", prefix, prefix, tickLocation_names);
          str += tmpStr;
          break;
      default:
          break;
    }

    const char *axesType_names = "ClosestTriad, FurthestTriad, OutsideEdges, StaticTriad, StaticEdges";
    switch (atts->GetAxesType())
    {
      case Axes3D::ClosestTriad:
          SNPRINTF(tmpStr, 1000, "%saxesType = %sClosestTriad  # %s\n", prefix, prefix, axesType_names);
          str += tmpStr;
          break;
      case Axes3D::FurthestTriad:
          SNPRINTF(tmpStr, 1000, "%saxesType = %sFurthestTriad  # %s\n", prefix, prefix, axesType_names);
          str += tmpStr;
          break;
      case Axes3D::OutsideEdges:
          SNPRINTF(tmpStr, 1000, "%saxesType = %sOutsideEdges  # %s\n", prefix, prefix, axesType_names);
          str += tmpStr;
          break;
      case Axes3D::StaticTriad:
          SNPRINTF(tmpStr, 1000, "%saxesType = %sStaticTriad  # %s\n", prefix, prefix, axesType_names);
          str += tmpStr;
          break;
      case Axes3D::StaticEdges:
          SNPRINTF(tmpStr, 1000, "%saxesType = %sStaticEdges  # %s\n", prefix, prefix, axesType_names);
          str += tmpStr;
          break;
      default:
          break;
    }

    if(atts->GetTriadFlag())
        SNPRINTF(tmpStr, 1000, "%striadFlag = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%striadFlag = 0\n", prefix);
    str += tmpStr;
    if(atts->GetBboxFlag())
        SNPRINTF(tmpStr, 1000, "%sbboxFlag = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%sbboxFlag = 0\n", prefix);
    str += tmpStr;
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "xAxis.";
        str += PyAxisAttributes_ToString(&atts->GetXAxis(), objPrefix.c_str());
    }
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "yAxis.";
        str += PyAxisAttributes_ToString(&atts->GetYAxis(), objPrefix.c_str());
    }
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "zAxis.";
        str += PyAxisAttributes_ToString(&atts->GetZAxis(), objPrefix.c_str());
    }
    if(atts->GetSetBBoxLocation())
        SNPRINTF(tmpStr, 1000, "%ssetBBoxLocation = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%ssetBBoxLocation = 0\n", prefix);
    str += tmpStr;
    {   const double *bboxLocation = atts->GetBboxLocation();
        SNPRINTF(tmpStr, 1000, "%sbboxLocation = (", prefix);
        str += tmpStr;
        for(int i = 0; i < 6; ++i)
        {
            SNPRINTF(tmpStr, 1000, "%g", bboxLocation[i]);
            str += tmpStr;
            if(i < 5)
            {
                SNPRINTF(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        SNPRINTF(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    return str;
}
Exemplo n.º 11
0
std::string
PyavtSubsetsMetaData_ToString(const avtSubsetsMetaData *atts, const char *prefix)
{
    std::string str;
    char tmpStr[1000];

    str = PyavtVarMetaData_ToString(atts, prefix);

    SNPRINTF(tmpStr, 1000, "%scatName = \"%s\"\n", prefix, atts->GetCatName().c_str());
    str += tmpStr;
    SNPRINTF(tmpStr, 1000, "%scatCount = %d\n", prefix, atts->GetCatCount());
    str += tmpStr;
    { // new scope
        std::string objPrefix(prefix);
        objPrefix += "nameScheme.";
        str += PyNameschemeAttributes_ToString(&atts->GetNameScheme(), objPrefix.c_str());
    }
    {   const stringVector &colorScheme = atts->colorScheme;
        SNPRINTF(tmpStr, 1000, "%scolorScheme = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < colorScheme.size(); ++i)
        {
            SNPRINTF(tmpStr, 1000, "\"%s\"", colorScheme[i].c_str());
            str += tmpStr;
            if(i < colorScheme.size() - 1)
            {
                SNPRINTF(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        SNPRINTF(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    {   const intVector &setsToChunksMaps = atts->GetSetsToChunksMaps();
        SNPRINTF(tmpStr, 1000, "%ssetsToChunksMaps = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < setsToChunksMaps.size(); ++i)
        {
            SNPRINTF(tmpStr, 1000, "%d", setsToChunksMaps[i]);
            str += tmpStr;
            if(i < setsToChunksMaps.size() - 1)
            {
                SNPRINTF(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        SNPRINTF(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    {   const intVector &graphEdges = atts->GetGraphEdges();
        SNPRINTF(tmpStr, 1000, "%sgraphEdges = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < graphEdges.size(); ++i)
        {
            SNPRINTF(tmpStr, 1000, "%d", graphEdges[i]);
            str += tmpStr;
            if(i < graphEdges.size() - 1)
            {
                SNPRINTF(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        SNPRINTF(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    if(atts->isChunkCat)
        SNPRINTF(tmpStr, 1000, "%sisChunkCat = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%sisChunkCat = 0\n", prefix);
    str += tmpStr;
    if(atts->isMaterialCat)
        SNPRINTF(tmpStr, 1000, "%sisMaterialCat = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%sisMaterialCat = 0\n", prefix);
    str += tmpStr;
    if(atts->isUnionOfChunks)
        SNPRINTF(tmpStr, 1000, "%sisUnionOfChunks = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%sisUnionOfChunks = 0\n", prefix);
    str += tmpStr;
    if(atts->hasPartialCells)
        SNPRINTF(tmpStr, 1000, "%shasPartialCells = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%shasPartialCells = 0\n", prefix);
    str += tmpStr;
    const char *decompMode_names = "None, Cover, Partition";
    switch (atts->decompMode)
    {
      case avtSubsetsMetaData::None:
          SNPRINTF(tmpStr, 1000, "%sdecompMode = %sNone  # %s\n", prefix, prefix, decompMode_names);
          str += tmpStr;
          break;
      case avtSubsetsMetaData::Cover:
          SNPRINTF(tmpStr, 1000, "%sdecompMode = %sCover  # %s\n", prefix, prefix, decompMode_names);
          str += tmpStr;
          break;
      case avtSubsetsMetaData::Partition:
          SNPRINTF(tmpStr, 1000, "%sdecompMode = %sPartition  # %s\n", prefix, prefix, decompMode_names);
          str += tmpStr;
          break;
      default:
          break;
    }

    SNPRINTF(tmpStr, 1000, "%smaxTopoDim = %d\n", prefix, atts->maxTopoDim);
    str += tmpStr;
    return str;
}
Exemplo n.º 12
0
std::string
PyMultiCurveAttributes_ToString(const MultiCurveAttributes *atts, const char *prefix)
{
    std::string str;
    char tmpStr[1000];

    {   // new scope
        std::string objPrefix(prefix);
        objPrefix += "defaultPalette.";
        str += PyColorControlPointList_ToString(&atts->GetDefaultPalette(), objPrefix.c_str());
    }
    {   const unsignedCharVector &changedColors = atts->GetChangedColors();
        SNPRINTF(tmpStr, 1000, "%schangedColors = (", prefix);
        str += tmpStr;
        for(size_t i = 0; i < changedColors.size(); ++i)
        {
            SNPRINTF(tmpStr, 1000, "%d", int(changedColors[i]));
            str += tmpStr;
            if(i < changedColors.size() - 1)
            {
                SNPRINTF(tmpStr, 1000, ", ");
                str += tmpStr;
            }
        }
        SNPRINTF(tmpStr, 1000, ")\n");
        str += tmpStr;
    }
    const char *colorType_names = "ColorBySingleColor, ColorByMultipleColors";
    switch (atts->GetColorType())
    {
    case MultiCurveAttributes::ColorBySingleColor:
        SNPRINTF(tmpStr, 1000, "%scolorType = %sColorBySingleColor  # %s\n", prefix, prefix, colorType_names);
        str += tmpStr;
        break;
    case MultiCurveAttributes::ColorByMultipleColors:
        SNPRINTF(tmpStr, 1000, "%scolorType = %sColorByMultipleColors  # %s\n", prefix, prefix, colorType_names);
        str += tmpStr;
        break;
    default:
        break;
    }

    const unsigned char *singleColor = atts->GetSingleColor().GetColor();
    SNPRINTF(tmpStr, 1000, "%ssingleColor = (%d, %d, %d, %d)\n", prefix, int(singleColor[0]), int(singleColor[1]), int(singleColor[2]), int(singleColor[3]));
    str += tmpStr;
    {   const ColorAttributeList &cL = atts->GetMultiColor();
        const char *comment = (prefix==0 || strcmp(prefix,"")==0) ? "# " : "";
        for(int i = 0; i < cL.GetNumColors(); ++i)
        {
            const unsigned char *c = cL[i].GetColor();
            SNPRINTF(tmpStr, 1000, "%s%sSetMultiColor(%d, (%d, %d, %d, %d))\n",
                     comment, prefix, i, int(c[0]), int(c[1]), int(c[2]), int(c[3]));
            str += tmpStr;
        }
    }
    const char *lineStyle_values[] = {"SOLID", "DASH", "DOT", "DOTDASH"};
    SNPRINTF(tmpStr, 1000, "%slineStyle = %s%s  # SOLID, DASH, DOT, DOTDASH\n", prefix, prefix, lineStyle_values[atts->GetLineStyle()]);
    str += tmpStr;
    SNPRINTF(tmpStr, 1000, "%slineWidth = %d\n", prefix, atts->GetLineWidth());
    str += tmpStr;
    SNPRINTF(tmpStr, 1000, "%syAxisTitleFormat = \"%s\"\n", prefix, atts->GetYAxisTitleFormat().c_str());
    str += tmpStr;
    if(atts->GetUseYAxisTickSpacing())
        SNPRINTF(tmpStr, 1000, "%suseYAxisTickSpacing = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%suseYAxisTickSpacing = 0\n", prefix);
    str += tmpStr;
    SNPRINTF(tmpStr, 1000, "%syAxisTickSpacing = %g\n", prefix, atts->GetYAxisTickSpacing());
    str += tmpStr;
    if(atts->GetDisplayMarkers())
        SNPRINTF(tmpStr, 1000, "%sdisplayMarkers = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%sdisplayMarkers = 0\n", prefix);
    str += tmpStr;
    SNPRINTF(tmpStr, 1000, "%smarkerVariable = \"%s\"\n", prefix, atts->GetMarkerVariable().c_str());
    str += tmpStr;
    if(atts->GetDisplayIds())
        SNPRINTF(tmpStr, 1000, "%sdisplayIds = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%sdisplayIds = 0\n", prefix);
    str += tmpStr;
    SNPRINTF(tmpStr, 1000, "%sidVariable = \"%s\"\n", prefix, atts->GetIdVariable().c_str());
    str += tmpStr;
    if(atts->GetLegendFlag())
        SNPRINTF(tmpStr, 1000, "%slegendFlag = 1\n", prefix);
    else
        SNPRINTF(tmpStr, 1000, "%slegendFlag = 0\n", prefix);
    str += tmpStr;
    return str;
}