//Constructs the document and places it in the provided state public NuGenDocument(DigitizeState state) { listeners = new List <NuGenImageListener>(); pointSets = new NuGenPointSetCollection(); segments = new NuGenSegmentCollection(); transform = new NuGenScreenTranslate(this); gridDisplay = new List <GridlineScreen>(); digitizeState = state; matchSet = new NuGenMatchSet(pointMatchSettings); //load all of the settings NuGenDefaultSettings rSettings = NuGenDefaultSettings.GetInstance(); coordSettings = rSettings.CoordSettings; exportSettings = rSettings.ExportSettings; segmentSettings = rSettings.SegmentSettings; pointMatchSettings = rSettings.PointMatchSettings; gridRemovalSettings = rSettings.GridRemovalSettings; gridDisplaySettings.initialized = false; gridDisplaySettings.gridSetX = rSettings.GridDisplayGridSetX; gridDisplaySettings.gridSetY = rSettings.GridDisplayGridSetY; discretizeSettings = rSettings.DiscretizeSettings; backgroundSelection = rSettings.BackgroundSelection; }
//Saves and adds all the points that are in the matchset from point matching public void SaveMatchedPoints() { DigitizeState old = DigitizeState; DigitizeState = DigitizeState.CurveState; foreach (MatchPoint p in matchSet.Matches) { if (p.Accepted) { AddPoint(p.Point.X, p.Point.Y); } } DigitizeState = old; }
private Cursor CursorFromState(DigitizeState state) { switch (state) { case DigitizeState.AxisState: return(Cursors.Cross); case DigitizeState.CurveState: return(Cursors.Cross); case DigitizeState.MeasureState: return(Cursors.Cross); case DigitizeState.PointMatchState: return(Cursors.Arrow); case DigitizeState.ScaleState: return(Cursors.Cross); case DigitizeState.SegmentState: return(Cursors.Arrow); case DigitizeState.SelectState: return(Cursors.Arrow); } return(Cursors.Default); }
//Deserialization constructor. public NuGenDocument(SerializationInfo info, StreamingContext ctxt) { backgroundSelection = (BackgroundSelection)info.GetValue("backgroundSelection", typeof(BackgroundSelection)); originalImage = (Image)info.GetValue("originalImage", typeof(Image)); title = (string)info.GetValue("title", typeof(string)); digitizeState = (DigitizeState)info.GetValue("digitizeState", typeof(DigitizeState)); currentCurveName = (string)info.GetValue("curveCmbText", typeof(string)); currentMeasureName = (string)info.GetValue("measureCmbText", typeof(string)); coordSettings.frame = (ReferenceFrame)info.GetValue("coordSettings.frame", typeof(ReferenceFrame)); coordSettings.thetaUnits = (ThetaUnits)info.GetValue("coordSettings.thetaUnits", typeof(ThetaUnits)); coordSettings.xThetaScale = (Scale)info.GetValue("coordSettings.xThetaScale", typeof(Scale)); coordSettings.yRScale = (Scale)info.GetValue("coordSettings.yRScale", typeof(Scale)); exportSettings.delimiters = (ExportDelimiters)info.GetValue("exportSettings.delimiters", typeof(ExportDelimiters)); exportSettings.layout = (ExportLayout)info.GetValue("exportSettings.layout", typeof(ExportLayout)); exportSettings.pointsSelection = (ExportPointsSelection)info.GetValue("exportSettings.pointsSelection", typeof(ExportPointsSelection)); exportSettings.header = (ExportHeader)info.GetValue("exportSettings.header", typeof(ExportHeader)); gridRemovalSettings.removeThinLines = (bool)info.GetValue("gridRemovalSettings.removeThinLines", typeof(bool)); gridRemovalSettings.thinThickness = (double)info.GetValue("gridRemovalSettings.thinThickness", typeof(double)); gridRemovalSettings.removeGridlines = (bool)info.GetValue("gridRemovalSettings.removeGridlines", typeof(bool)); gridRemovalSettings.gridMesh.initialized = (bool)info.GetValue("gridRemovalSettings.gridMesh.initialized", typeof(bool)); gridRemovalSettings.gridMesh.countX = (int)info.GetValue("gridRemovalSettings.gridMesh.countX", typeof(int)); gridRemovalSettings.gridMesh.countY = (int)info.GetValue("gridRemovalSettings.gridMesh.countY", typeof(int)); gridRemovalSettings.gridMesh.gridSetX = (GridSet)info.GetValue("gridRemovalSettings.gridMesh.gridSetX", typeof(GridSet)); gridRemovalSettings.gridMesh.gridSetY = (GridSet)info.GetValue("gridRemovalSettings.gridMesh.gridSetY", typeof(GridSet)); gridRemovalSettings.gridMesh.startX = (double)info.GetValue("gridRemovalSettings.gridMesh.startX", typeof(double)); gridRemovalSettings.gridMesh.startY = (double)info.GetValue("gridRemovalSettings.gridMesh.startY", typeof(double)); gridRemovalSettings.gridMesh.stepX = (double)info.GetValue("gridRemovalSettings.gridMesh.stepX", typeof(double)); gridRemovalSettings.gridMesh.stepY = (double)info.GetValue("gridRemovalSettings.gridMesh.stepY", typeof(double)); gridRemovalSettings.gridMesh.stopX = (double)info.GetValue("gridRemovalSettings.gridMesh.stopX", typeof(double)); gridRemovalSettings.gridMesh.stopY = (double)info.GetValue("gridRemovalSettings.gridMesh.stopY", typeof(double)); gridRemovalSettings.gridDistance = (double)info.GetValue("gridRemovalSettings.gridDistance", typeof(double)); gridRemovalSettings.removeColor = (bool)info.GetValue("gridRemovalSettings.removeColor", typeof(bool)); gridRemovalSettings.color = (Color)info.GetValue("gridRemovalSettings.color", typeof(Color)); gridRemovalSettings.foregroundThresholdLow = (int)info.GetValue("gridRemovalSettings.foregroundThresholdLow", typeof(int)); gridRemovalSettings.foregroundThresholdHigh = (int)info.GetValue("gridRemovalSettings.foregroundThresholdHigh", typeof(int)); gridRemovalSettings.gapSeparation = (double)info.GetValue("gridRemovalSettings.gapSeparation", typeof(double)); gridDisplaySettings.initialized = (bool)info.GetValue("gridDisplaySettings.initialized", typeof(bool)); gridDisplaySettings.countX = (int)info.GetValue("gridDisplaySettings.countX", typeof(int)); gridDisplaySettings.countY = (int)info.GetValue("gridDisplaySettings.countY", typeof(int)); gridDisplaySettings.gridSetX = (GridSet)info.GetValue("gridDisplaySettings.gridSetX", typeof(GridSet)); gridDisplaySettings.gridSetY = (GridSet)info.GetValue("gridDisplaySettings.gridSetY", typeof(GridSet)); gridDisplaySettings.startX = (double)info.GetValue("gridDisplaySettings.startX", typeof(double)); gridDisplaySettings.startY = (double)info.GetValue("gridDisplaySettings.startY", typeof(double)); gridDisplaySettings.stepX = (double)info.GetValue("gridDisplaySettings.stepX", typeof(double)); gridDisplaySettings.stepY = (double)info.GetValue("gridDisplaySettings.stepY", typeof(double)); gridDisplaySettings.stopX = (double)info.GetValue("gridDisplaySettings.stopX", typeof(double)); gridDisplaySettings.stopY = (double)info.GetValue("gridDisplaySettings.stopY", typeof(double)); segmentSettings.minPoints = (int)info.GetValue("segmentSettings.minPoints", typeof(int)); segmentSettings.pointSeparation = (int)info.GetValue("segmentSettings.pointSeparation", typeof(int)); segmentSettings.lineSize = (LineSize)info.GetValue("segmentSettings.lineSize", typeof(LineSize)); segmentSettings.lineColor = (Color)info.GetValue("segmentSettings.lineColor", typeof(Color)); pointMatchSettings.pointSeparation = (int)info.GetValue("pointMatchSettings.pointSeparation", typeof(int)); pointMatchSettings.pointSize = (int)info.GetValue("pointMatchSettings.pointSize", typeof(int)); pointMatchSettings.acceptedColor = (Color)info.GetValue("pointMatchSettings.acceptedColor", typeof(Color)); pointMatchSettings.rejectedColor = (Color)info.GetValue("pointMatchSettings.rejectedColor", typeof(Color)); discretizeSettings.discretizeMethod = (DiscretizeMethod)info.GetValue("discretizeSettings.discretizeMethod", typeof(DiscretizeMethod)); discretizeSettings.intensityThresholdLow = (int)info.GetValue("discretizeSettings.intensityThresholdLow", typeof(int)); discretizeSettings.intensityThresholdHigh = (int)info.GetValue("discretizeSettings.intensityThresholdHigh", typeof(int)); discretizeSettings.foregroundThresholdLow = (int)info.GetValue("discretizeSettings.foregroundThresholdLow", typeof(int)); discretizeSettings.foregroundThresholdHigh = (int)info.GetValue("discretizeSettings.foregroundThresholdHigh", typeof(int)); discretizeSettings.hueThresholdLow = (int)info.GetValue("discretizeSettings.hueThresholdLow", typeof(int)); discretizeSettings.hueThresholdHigh = (int)info.GetValue("discretizeSettings.hueThresholdHigh", typeof(int)); discretizeSettings.saturationThresholdLow = (int)info.GetValue("discretizeSettings.saturationThresholdLow", typeof(int)); discretizeSettings.saturationThresholdHigh = (int)info.GetValue("discretizeSettings.saturationThresholdHigh", typeof(int)); discretizeSettings.valueThresholdLow = (int)info.GetValue("discretizeSettings.valueThresholdLow", typeof(int)); discretizeSettings.valueThresholdHigh = (int)info.GetValue("discretizeSettings.valueThresholdHigh", typeof(int)); pointSets = new NuGenPointSetCollection(); PointSets.SerializeRead(info); saveFileExists = true; dirtyAxesTransformation = true; dirtyScaleTransformation = true; listeners = new List <NuGenImageListener>(); segments = new NuGenSegmentCollection(); transform = new NuGenScreenTranslate(this); gridDisplay = new List <GridlineScreen>(); matchSet = new NuGenMatchSet(pointMatchSettings); ProcessOriginialImage(); }
private Cursor CursorFromState(DigitizeState state) { switch (state) { case DigitizeState.AxisState: return Cursors.Cross; case DigitizeState.CurveState: return Cursors.Cross; case DigitizeState.MeasureState: return Cursors.Cross; case DigitizeState.PointMatchState: return Cursors.Arrow; case DigitizeState.ScaleState: return Cursors.Cross; case DigitizeState.SegmentState: return Cursors.Arrow; case DigitizeState.SelectState: return Cursors.Arrow; } return Cursors.Default; }