// ****************************************************************************
//  Method:  avtAxisRestrictionToolInterface::ResetNumberOfAxes
//
//  Purpose:
//    Sets the number of available axes.
//
//  Arguments:
//    n          the number of axes
//
//  Programmer:  Jeremy Meredith
//  Creation:    February  1, 2008
//
//  Modifications:
//    Jeremy Meredith, Fri Feb 15 13:21:20 EST 2008
//    Added axis names to the axis restriction attributes.
//
// ****************************************************************************
void
avtAxisRestrictionToolInterface::ResetNumberOfAxes(int n)
{
    AxisRestrictionAttributes *a = (AxisRestrictionAttributes *)atts;
    stringVector aname(n, "");
    doubleVector amin(n, -1e+37);
    doubleVector amax(n, +1e+37);
    a->SetNames(aname);
    a->SetMinima(amin);
    a->SetMaxima(amax);
}
// ****************************************************************************
//  Method:  avtAxisRestrictionToolInterface::GetAxisMax
//
//  Purpose:
//    Gets the max for an axis.
//
//  Arguments:
//    i          the axis value to retrieve 
//
//  Programmer:  Jeremy Meredith
//  Creation:    February  1, 2008
//
// ****************************************************************************
double
avtAxisRestrictionToolInterface::GetAxisMax(int i) const
{
    AxisRestrictionAttributes *a = (AxisRestrictionAttributes *)atts;
    const doubleVector &m = a->GetMaxima();
    if (m.size() <= (size_t)i)
    {
        return +1e+37;
    }
    return m[i];
}
// ****************************************************************************
//  Method:  avtAxisRestrictionToolInterface::GetAxisName
//
//  Purpose:
//    Gets the name for an axis.
//
//  Arguments:
//    i          the axis value to retrieve 
//
//  Programmer:  Jeremy Meredith
//  Creation:    February  1, 2008
//
// ****************************************************************************
std::string
avtAxisRestrictionToolInterface::GetAxisName(int i) const
{
    AxisRestrictionAttributes *a = (AxisRestrictionAttributes *)atts;
    const stringVector &n = a->GetNames();
    if (n.size() <= (size_t)i)
    {
        return "";
    }
    return n[i];
}
// ****************************************************************************
//  Method:  avtAxisRestrictionToolInterface::SetAxisMax
//
//  Purpose:
//    Sets the max for an axis.
//
//  Arguments:
//    i          the axis value to set
//    x          the value 
//
//  Programmer:  Jeremy Meredith
//  Creation:    February  1, 2008
//
// ****************************************************************************
void
avtAxisRestrictionToolInterface::SetAxisMax(int i, double x)
{
    AxisRestrictionAttributes *a = (AxisRestrictionAttributes *)atts;
    doubleVector &m = a->GetMaxima();
    if (m.size() <= (size_t)i)
    {
        // don't bother erroring, either exit or resize
        return;
        //m.resize(i+1, +1e+37);
    }
    m[i] = x;
    a->SelectAll();
}
// ****************************************************************************
//  Method:  avtAxisRestrictionToolInterface::SetAxisName
//
//  Purpose:
//    Sets the name for an axis.
//
//  Arguments:
//    i          the axis name to set 
//    s          the name 
//
//  Programmer:  Jeremy Meredith
//  Creation:    February 15, 2008
//
// ****************************************************************************
void
avtAxisRestrictionToolInterface::SetAxisName(int i, const std::string &s)
{
    AxisRestrictionAttributes *a = (AxisRestrictionAttributes *)atts;
    stringVector &n = a->GetNames();
    if (n.size() <= (size_t)i)
    {
        // don't bother erroring, either exit or resize
        return;
        //m.resize(i+1, -1e+37);
    }
    n[i] = s;
    a->SelectAll();
}
Esempio n. 6
0
// ****************************************************************************
//  Method:  ParallelCoordinatesAttributes::CreateCompatible
//
//  Purpose:
//    Creates an object of the specified type initialized with the
//    attributes from this object.
//
//  Arguments:
//    tname : The typename of the object that we want to create.
//
//  Returns:    A new object of the type specified by tname or 0.
//
//  Programmer:  Jeremy Meredith
//  Creation:    February  8, 2008
//
//  Modifications:
//    Jeremy Meredith, Fri Feb 15 13:13:56 EST 2008
//    Added better support for axis names.
//
// ****************************************************************************
AttributeSubject *
ParallelCoordinatesAttributes::CreateCompatible(const std::string &tname) const
{
    AttributeSubject *retval = 0;

    if(TypeName() == tname)
    {
        retval = new ParallelCoordinatesAttributes(*this);
    }
    else if (tname == "AxisRestrictionAttributes" ||
             tname == "ThresholdAttributes")
    {
        // Note: my hope was that we could update the plot attributes
        // and have it connect with a threshold tool in another window.
        // Unfortunately, CreateCompatible("ThresholdAttributes") isn't
        // called, so there's a missing path issue.  We could probably
        // get rid of the support for Threshold here.
        AxisRestrictionAttributes *ar = new AxisRestrictionAttributes;

        ar->SetNames(visualAxisNames);
        ar->SetMinima(extentMinima);
        ar->SetMaxima(extentMaxima);

        if (tname == "AxisRestrictionAttributes")
        {
            retval = ar;
        }
        else
        {
            retval = ar->CreateCompatible(tname);
            delete ar;
        }
    }

    return retval;
}