/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.geoforge.jfreechart.data.xy;
import java.util.List;
import org.geoforge.lang.util.GfrUnits;
import org.geoforge.lang.util.number.GfrDouble;
import org.jfree.data.xy.XYDataItem;
/**
*
* @author robert
*/
abstract public class GfrXYSeriesDepVrtFixLogAbs extends GfrXYSeriesDepAbs
{
protected double _dblShiftDepthMeter = GfrDouble.DBL_NDV;
protected double _dblRefElevMeter_ = GfrDouble.DBL_NDV;
protected double _dblElevMeterOwner_ = GfrDouble.DBL_NDV;
protected GfrXYSeriesDepVrtFixLogAbs(
String strIdParent,
String strWhat,
String strNameTlo,
boolean blnUnitDepthMeter,
double dblShiftDepthMeter,
double dblRefElevMeter,
double dblElevMeterOwner) throws Exception
{
super(strIdParent,
strWhat,
strNameTlo,
blnUnitDepthMeter);
this._dblShiftDepthMeter = dblShiftDepthMeter;
this._dblRefElevMeter_ = dblRefElevMeter;
this._dblElevMeterOwner_ = dblElevMeterOwner;
_fill();
}
protected double _getValueDepth(double dblValueSource, boolean blnUnitDepthMeterLog)
{
double dblResult = dblValueSource;
double dblShift = this._dblShiftDepthMeter;
if (super.isUnitDepthMeter() && !blnUnitDepthMeterLog)
{
dblResult *= GfrUnits.DBL_K_METER_FOOT;
if (dblShift!=GfrDouble.DBL_NDV && dblShift!=0d)
dblResult += dblShift;
}
else if (!super.isUnitDepthMeter() && blnUnitDepthMeterLog)
{
dblResult /= GfrUnits.DBL_K_METER_FOOT;
if (dblShift!=GfrDouble.DBL_NDV && dblShift!=0d)
{
dblShift /= GfrUnits.DBL_K_METER_FOOT;
dblResult += dblShift;
}
}
else if (super.isUnitDepthMeter() && blnUnitDepthMeterLog)
{
if (dblShift!=GfrDouble.DBL_NDV && dblShift!=0d)
dblResult += dblShift;
}
else // all in feet
{
if (dblShift!=GfrDouble.DBL_NDV && dblShift!=0d)
{
dblShift /= GfrUnits.DBL_K_METER_FOOT;
dblResult += dblShift;
}
}
return dblResult;
}
public void resetDepth()
{
// GfrXYDataItemDepVrtFixId
List lst = super.getItems();
for (Object objCur: lst)
{
GfrXYDataItemDepVrtFixId itm = (GfrXYDataItemDepVrtFixId) objCur;
itm.resetDepth();
}
this._dblShiftDepthMeter = GfrDouble.DBL_NDV;
}
public void shiftDepth(double dblShift)
{
List lst = super.getItems();
for (Object objCur: lst)
{
XYDataItem itm = (XYDataItem) objCur;
double dblX = itm.getXValue();
dblX += dblShift;
itm.setX(new Double(dblX));
}
}
}