Package simtools.shapes

Examples of simtools.shapes.CurveShape


        TimeStampedDataSource ds = (TimeStampedDataSource)obar[0];
        boolean primary = ((Boolean)obar[1]).booleanValue();
        boolean usePrimaryX = ((Boolean)obar[2]).booleanValue();

        Rectangle bounds = getBounds();
        CurveShape cs;

        if (usePrimaryX) {

            cs = createCurveShape(ds.getTime(), ds);
            if (isPrimaryBounded) cs.setSlice(primaryStartIndex, primaryEndIndex);
        } else {
            cs = createCurveShape(ds.getTime(), ds);
            if (isSecondaryBounded) cs.setSlice(secondaryStartIndex, secondaryEndIndex);
        }

        String label = DEFAULT_DISPLAY_DATA_SOURCE_ID? DataInfo.getAliasOrIdwithUnit(ds) : DataInfo.getAliasOrLabelwithUnit(ds);
        if (primary) {
            if (primaryCurves==null) primaryCurves = new Vector();
View Full Code Here


        Plot p = (Plot)super.cloneShape();
        if (primaryCurves!=null){
            p.primaryCurves=new Vector();
            for(int i=0;i<primaryCurves.size();i++){
                int rank=_curves.indexOf(getCurve((CurveShape)primaryCurves.get(i)));
                CurveShape cs=(CurveShape)((Curve)p._curves.get(rank)).shape;
                p.primaryCurves.add(cs);
            }
        }
        if (secondaryCurves!=null){
            p.secondaryCurves=new Vector();
            for(int i=0;i<secondaryCurves.size();i++){
                int rank=_curves.indexOf(getCurve((CurveShape)secondaryCurves.get(i)));
                CurveShape cs=(CurveShape)((Curve)p._curves.get(rank)).shape;
                p.secondaryCurves.add(cs);
            }
        }   
        p.axesLimitsArray = new AxeRange[AXE_NUMBER];
        for (int i = 0; i < p.axesLimitsArray.length; i++) {
View Full Code Here

            }

            // update all curves using the old x source
            if (primaryCurves!=null) {
                for (Iterator it = primaryCurves.iterator(); it.hasNext(); ) {
                    CurveShape cs = (CurveShape)it.next();
                    try{
                        if (cs.getXSource()==oldX) {
                            cs.setData(ds, cs.getYSource());
                            if (isPrimaryBounded) cs.setSlice(primaryStartIndex, primaryEndIndex);
                        }
                    }catch (DataException e){}
                }
            }
            if (secondaryCurves!=null) {
                for (Iterator it = secondaryCurves.iterator(); it.hasNext(); ) {
                    CurveShape cs = (CurveShape)it.next();
                    try{
                        if (cs.getXSource()==oldX) {
                            cs.setData(ds, cs.getYSource());
                            if (isSecondaryBounded) cs.setSlice(secondaryStartIndex, secondaryEndIndex);
                        }
                    }catch (DataException e){}
                }
            }
            repaintDiagram(bounds);
View Full Code Here

        repaintDiagram(bounds);
        return cs;
    }
   
    protected CurveShape createCurveShape(DataSource xds, DataSource yds){
        return new CurveShape(xds, yds);
    }
View Full Code Here

        DataSource ds = (DataSource)obar[0];
        boolean primary = ((Boolean)obar[1]).booleanValue();
        boolean usePrimaryX = ((Boolean)obar[2]).booleanValue();

        Rectangle bounds = getBounds();
        CurveShape cs;
        if (usePrimaryX) {
            cs = createCurveShape(primaryX, ds);
            if (isPrimaryBounded) cs.setSlice(primaryStartIndex, primaryEndIndex);
        } else {
            cs = createCurveShape(secondaryX, ds);
            if (isSecondaryBounded) cs.setSlice(secondaryStartIndex, secondaryEndIndex);
        }
        String label = DEFAULT_DISPLAY_DATA_SOURCE_ID? DataInfo.getAliasOrIdwithUnit(ds) : DataInfo.getAliasOrLabelwithUnit(ds);
        if (primary) {
            if (primaryCurves==null) primaryCurves = new Vector();
            primaryCurves.add(cs);
View Full Code Here

            }
            yAxeRange.min= Double.POSITIVE_INFINITY;
            yAxeRange.max= Double.NEGATIVE_INFINITY;
           
            for(int i=0; i < curves.size(); i++) {
                CurveShape curveShape = (CurveShape)curves.get(i);
                AxeRange xAxerange = getCurve(curveShape).secondaryXaxis? axesLimitsArray[SX] : axesLimitsArray[PX];
               
                boolean useYdataMinandMax = canUseCurveSourcesMinMax(xAxerange, curveShape);
                try {

                    // When curve X range is not included into current X axis range, we have to compute the curve Y range related to X axis range
                    if (!useYdataMinandMax) {
                       
                        curveShape.computeYLocalRange(xAxerange.min, xAxerange.max);
                       
                        double curveYmin = curveShape.getLocalRangeMinPoint().y;
                        double curveYmax = curveShape.getLocalRangeMaxPoint().y;

                        if (curveYmin < yAxeRange.min) {
                            yAxeRange.min = curveYmin;
                        }
                        if (curveYmax > yAxeRange.max) {
                            yAxeRange.max = curveYmax;
                        }
                    }

                } catch (DataException e) {
                    useYdataMinandMax = true;
                }

                // When curve X range is included into current X axis range, we can direct get curve Y mon and max from data source
                try {
                    if (useYdataMinandMax) {
                        DataSource currentYSource = curveShape.getYSource();
                        double candidateMin = currentYSource.getDoubleMin();
                        double candidateMax = currentYSource.getDoubleMax();

                        if (candidateMin < yAxeRange.min){
                            yAxeRange.min = candidateMin;
                        }
                        if (candidateMax > yAxeRange.max){
                            yAxeRange.max = candidateMax;
                        }  
                    }

                    // Update format
                    if (format!=null && !format.equals(curveShape.getYSource().getChoiceFormat())){
                        format = null;
                    }
                   
                } catch (DataException e) {
                    useYdataMinandMax = true;
View Full Code Here

    public void shapeDataChanged(CurveShape csc, DataSource oldData, DataSource newData, boolean onX) {
        super.shapeDataChanged(csc, oldData, newData, onX);
        if (primaryCurves!=null && onX) {
            for (Iterator it = primaryCurves.iterator(); it.hasNext(); ) {
                CurveShape cs = (CurveShape)it.next();
                if (csc==cs){
                    if(primaryX == oldData) {
                        primaryX=newData;
                        if (isPrimaryBounded && (primaryX!=null)) {
                            try {
                                long imin = primaryX.getStartIndex();
                                long imax = primaryX.getLastIndex();
                                if (imin>primaryStartIndex) primaryStartIndex = imin;
                                if (imax<primaryEndIndex) primaryEndIndex = imax;
                            }
                            catch (UnsupportedOperation uo1) {
                                isPrimaryBounded = false;
                            }
                        }
                    }
                }
            }
        }
        if (secondaryCurves!=null && onX) {
            for (Iterator it = secondaryCurves.iterator(); it.hasNext(); ) {
                CurveShape cs = (CurveShape)it.next();
                if (csc==cs){
                    if(secondaryX == oldData) {
                        secondaryX=newData;
                        if (isSecondaryBounded && (secondaryX!=null)) {
                            try {
View Full Code Here

        // fix old bugs on cloned plots
        for(int k=0;k<2;k++){
            Vector curves=(k==0) ? primaryCurves : secondaryCurves;
            if (curves != null) {
                for (int i = 0; i < curves.size(); i++) {
                    CurveShape cs = (CurveShape) curves.get(i);
                    Curve c = getCurve(cs);
                    if (c == null) {
                        System.err.print("Try to fix wrong curve shape ...");
                        for (int j = 0; j < _curves.size(); j++) {
                            c = (Curve) _curves.get(j);
                            try{
                                if ((c.shape.getXSource() == cs.getXSource())
                                        && (c.shape.getYSource() == cs.getYSource())) {
                                    c.shape = cs;
                                    System.err.print(" OK");
                                    break;
                                }
                            }catch (DataException e){}
                        }
                        System.err.println("");
                    }
                }
            }
        }

        // Update curves label in case display label mode has changed
        for (int i=0;i<_curves.size();i++){
            CurveShape curveShape = ((Curve)_curves.get(i)).shape;  
            try{
                DataSource ds= curveShape.getYSource();
                if (ds != null) {
                    String label = DEFAULT_DISPLAY_DATA_SOURCE_ID? DataInfo.getAliasOrIdwithUnit(ds) : DataInfo.getAliasOrLabelwithUnit(ds);
                    setCurveLabel(curveShape,label);
                }
            }catch (DataException e){}
View Full Code Here

     */
    protected Vector getCurveParametersList(Vector curves){
        Vector l=new Vector();
        if(curves!=null){
            for(int i=0;i<curves.size();i++){
                CurveShape cs = (CurveShape) curves.get(i);
                l.add(getCurveParameters(cs));
            }
        }
        return l;
    }
View Full Code Here

        }

        // Add new curves
        for(int i=0;i<l.size();i++){
            CurvePropertiesPanel.CurveParameters cp=(CurvePropertiesPanel.CurveParameters)l.get(i);
            CurveShape cs = doAddYAction(new Object[]{cp.yds, new Boolean(cp.usePrimaryY), new Boolean(cp.usePrimaryX)});
            setCurve(getCurve(cs), cp);
        }
    }
View Full Code Here

TOP

Related Classes of simtools.shapes.CurveShape

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.