internal void Resolve(CadastralMapModel model) { IFeatureRef fr = m_LineRef.ReferenceFrom; Debug.Assert(fr is Operation); Feature f = model.Find <Feature>(m_LineRef.InternalId); if (f == null) { throw new ApplicationException("Cannot locate forward reference " + m_LineRef.InternalId); } // Only IntersectDirectionAndLineOperation has forward splits, so follow that logic LineFeature line = (LineFeature)f; var dff = new DeserializationFactory(fr as Operation); dff.AddLineSplit(line, DataField.SplitBefore, m_SplitBeforeId); dff.AddLineSplit(line, DataField.SplitAfter, m_SplitAfterId); IntersectOperation xop = (IntersectOperation)fr; LineFeature lineBefore, lineAfter; dff.MakeSections(line, DataField.SplitBefore, xop.IntersectionPoint, DataField.SplitAfter, out lineBefore, out lineAfter); }
/// <summary> /// Reacts to selection of the OK button in the dialog. /// </summary> /// <param name="wnd">The dialog window. If this matches the dialog that /// this command knows about, the command will be executed (and, on success, /// the dialog will be destroyed). If it's some other window, it must /// be a sub-dialog created by our guy, so let it handle the request.</param> /// <returns></returns> internal override bool DialFinish(Control wnd) { if (m_Dialog == null) { MessageBox.Show("LineExtensionUI.DialFinish - No dialog!"); return(false); } // If we are doing an update, alter the original operation. UpdateUI up = this.Update; if (up != null) { // Get the original operation. LineExtensionOperation pop = (up.GetOp() as LineExtensionOperation); if (pop == null) { MessageBox.Show("LineExtensionUI.DialFinish - Unexpected edit type."); return(false); } // Remember the changes as part of the UI object (the original edit remains // unchanged for now) UpdateItemCollection changes = pop.GetUpdateItems(m_Dialog.IsExtendFromEnd, m_Dialog.Length); if (!up.AddUpdate(pop, changes)) { return(false); } } else { // Get info from the dialog m_IsExtendFromEnd = m_Dialog.IsExtendFromEnd; m_Length = m_Dialog.Length; IdHandle idh = m_Dialog.PointId; CadastralMapModel map = CadastralMapModel.Current; m_LineType = (m_Dialog.WantLine ? map.DefaultLineType : null); // Execute the edit LineExtensionOperation op = null; try { op = new LineExtensionOperation(m_ExtendLine, m_IsExtendFromEnd, m_Length); op.Execute(idh, m_LineType); } catch (Exception ex) { MessageBox.Show(ex.StackTrace, ex.Message); return(false); } } // Destroy the dialog(s). KillDialogs(); // Get the base class to finish up. return(FinishCommand()); }
/// <summary> /// Creates a new <c>CleanupQuery</c> and executes it. /// </summary> /// <param name="model">The model to clean</param> internal CleanupQuery(CadastralMapModel model) { if (model==null) throw new ArgumentNullException(); m_Model = model; m_UpdateWindow = new Window(); m_Deletions = new List<ISpatialObject>(100); m_Moves = new List<Feature>(100); // Cleanup features model.Index.QueryWindow(null, SpatialType.Feature, CleanupFeature); // Cleanup polygons model.Index.QueryWindow(null, SpatialType.Polygon, CleanupPolygon); // Remove stuff from spatial index if it's been deleted EditingIndex index = model.EditingIndex; foreach (ISpatialObject o in m_Deletions) { m_UpdateWindow.Union(o.Extent); if (o is Feature) index.RemoveFeature((Feature)o); else if (o is Ring) index.Remove(o); else throw new ApplicationException("Unexpected data type: " + o.GetType().Name); } }
/// <summary> /// Adds a termination point (or re-use a point if it happens to be the offset point). /// </summary> /// <param name="loc">The location for the termination point.</param> /// <returns>The point feature at the termination point (may be the position that was /// used to define the offset to the parallel line).</returns> PointFeature AddPoint(IPosition loc) { CadastralMapModel map = CadastralMapModel.Current; // Add the split point (with default entity type). If a // point already exists at the location, you'll get back // that point instead. // We do this in case the user has decided to // terminate on a line connected to the offset point // that defines the offset to the parallel (which the // UI lets the user do). PointFeature p = this.OffsetPoint; if (p != null) { IPointGeometry pg = PointGeometry.Create(loc); if (p.IsCoincident(pg)) { return(p); } } p = map.AddPoint(p, map.DefaultPointType, this); p.SetNextId(); return(p); }
/// <summary> /// Is the line that's being added going to form a polygon boundary? /// </summary> /// <returns></returns> bool AddingTopology() { CadastralMapModel map = CadastralMapModel.Current; IEntity ent = map.DefaultLineType; return(ent == null ? false : ent.IsPolygonBoundaryValid); }
/// <summary> /// Obtains the ID object that corresponds to the supplied formatted key. /// </summary> /// <param name="keystr">The formatted key obtained during the import</param> /// <returns>The ID corresponding to the supplied key (null if the supplied key is null /// or blank)</returns> ForeignId GetFeatureId(string keystr) { if (String.IsNullOrEmpty(keystr)) { return(null); } // First check the current map model to see if the supplied key matches a // previously created ID CadastralMapModel mapModel = CadastralMapModel.Current; ForeignId result = mapModel.FindForeignId(keystr); if (result != null) { return(result); } // Check the index of keys that have been created during this import (they // won't be added to the map model until the loading phase has been completed). if (m_KeyIndex.TryGetValue(keystr, out result)) { return(result); } // Remember a new foreign key as part of this import (it will be added to the model // after the loading phase has been completed) result = new ForeignId(keystr); m_KeyIndex.Add(keystr, result); return(result); }
private void okButton_Click(object sender, EventArgs e) { // The entity type must be defined. m_Entity = entityTypeComboBox.SelectedEntityType; if (m_Entity == null) { MessageBox.Show("The text type hasn't been specified."); entityTypeComboBox.Focus(); return; } // The text must be defined (obviously) m_Text = textTextBox.Text.Trim(); if (m_Text.Length == 0) { MessageBox.Show("You haven't specified any text"); textTextBox.Focus(); return; } // If the specified entity type is not the default for misc // text, make it the default. CadastralMapModel map = CadastralMapModel.Current; IEntity curDef = map.DefaultTextType; if (curDef == null || curDef.Id != m_Entity.Id) { map.SetDefaultEntity(SpatialType.Text, m_Entity); } DialogResult = DialogResult.OK; Close(); }
/// <summary> /// Tries to find a terminal line to end the parallel on. /// </summary> /// <returns>False if parallel positions are not available. True /// otherwise (that does not mean that a terminal was actually found). /// </returns> bool FindTerminal() { // Get the position of the parallel point. ParallelLineUI cmd = this.Command; IPosition parpos; if (m_IsLast) { parpos = cmd.ParallelTwo; } else { parpos = cmd.ParallelOne; } // The parallel point HAS to be known. if (parpos == null) { MessageBox.Show("Parallel point has not been calculated"); return(false); } // Treat the parallel point as the initial terminal. m_Terminal = parpos; // Get the offset to the parallel. double offset = cmd.GetPlanarOffset(); // Figure out a search radius (the smaller of half the offset, // or half a centimetre at the current draw scale). double scale = cmd.ActiveDisplay.MapScale; ILength tol = new Length(Math.Min(offset * 0.5, scale * 0.005)); // Search for the line closest to the parallel point, and // within the search radius. The line has to be visible // and selectable. CadastralMapModel map = CadastralMapModel.Current; //m_Line = map.FindClosestLine(parpos, tol, true); m_Line = (map.Index.QueryClosest(parpos, tol, SpatialType.Line) as LineFeature); // If we found something, highlight it (after confirming that // it really does intersect the parallel). if (m_Line != null) { IPosition xsect = cmd.GetIntersect(m_Line, m_IsLast); if (xsect == null) { m_Line = null; } else { //pView->UnHighlight(m_pArc); //pView->Highlight(*m_pArc); m_Terminal = xsect; } } return(true); }
/// <summary> /// /// </summary> /// <param name="line"></param> internal void OnLineDeactivation(LineFeature line) { // Remove the reference the intersection has to the line Remove(line); // If the intersection now refers only to one line, it's no longer // an intersection, so remove it from the spatial index and merge // the sections incident on the intersection. if (m_Lines.Count <= 1) { if (IsIndexed) { CadastralMapModel map = line.MapModel; EditingIndex index = map.EditingIndex; index.RemoveIntersection(this); } if (m_Lines.Count > 0) { Topology t = m_Lines[0].Topology; if (t != null) { // Merge the two sections - if we end up with just one // section covering the whole line, replace list topology // with fresh topology for the whole line. if (t.MergeSections(this) == 1) { m_Lines[0].SetTopology(true); } } } } }
void ShowUnitsPage(CadastralMapModel cmm) { EditingController ec = EditingController.Current; SetEntryUnit(ec.EntryUnit); SetDisplayUnit(ec.DisplayUnit); }
private void CoordSystemForm_Shown(object sender, EventArgs e) { CadastralMapModel map = CadastralMapModel.Current; ISpatialSystem sys = map.SpatialSystem; systemNameLabel.Text = sys.Name; epsgNumberLabel.Text = sys.EpsgNumber.ToString(); // Display mean elevation and geoid separation in the current data entry units. EditingController ec = EditingController.Current; DistanceUnit eUnit = ec.EntryUnit; DistanceUnit meters = EditingController.GetUnits(DistanceUnitType.Meters); // The mean elevation & geoid separation fields are always editable (even // if the map contains stuff). The values are used to calculate the ground // area of polygons. Distance elev = new Distance(sys.MeanElevation.Meters, meters); meanElevationTextBox.Text = elev.Format(eUnit, true); Distance sep = new Distance(sys.GeoidSeparation.Meters, meters); geoidSeparationTextBox.Text = sep.Format(eUnit, true); }
/// <summary> /// Attempts to resolves this forward reference. /// </summary> /// <param name="mapModel">The map model that should now contain the relevant features.</param> internal override void Resolve(CadastralMapModel mapModel) { Feature f = mapModel.Find<Feature>(InternalId); if (f == null) throw new ApplicationException("Cannot locate forward reference " + InternalId); ReferenceFrom.ApplyFeatureRef(Field, f); }
void ShowPointsPage(CadastralMapModel cmm) { ProjectSettings ps = EditingController.Current.Project.Settings; pointScaleTextBox.Text = String.Format("{0:F0}", ps.ShowPointScale); pointSizeTextBox.Text = String.Format("{0:F2}", ps.PointHeight); showIntersectionsCheckBox.Checked = ps.AreIntersectionsDrawn; }
void ShowLabelsPage(CadastralMapModel cmm) { ProjectSettings ps = EditingController.Current.Project.Settings; labelScaleTextBox.Text = String.Format("{0:F0}", ps.ShowLabelScale); textRotationAngleLabel.Text = RadianValue.AsShortString(cmm.DefaultTextRotation); nominalScaleTextBox.Text = ps.NominalMapScale.ToString(); ShowFont(); }
/// <summary> /// Changes the text for this object /// </summary> /// <param name="s">The new value for this geometry</param> internal void SetText(TextFeature label, string s) { CadastralMapModel map = label.MapModel; EditingIndex index = map.EditingIndex; index.RemoveFeature(label); m_Text = s; index.AddFeature(label); }
bool SaveLineAnnotationPage(CadastralMapModel cmm) { LineAnnotationStyle anno = EditingController.Current.LineAnnotationStyle; // Annotation scale threshold double showScale; if (!Double.TryParse(annoScaleTextBox.Text, out showScale)) { tabControl.SelectedTab = LineAnnotationTabPage; annoScaleTextBox.Focus(); MessageBox.Show("Cannot parse scale threshold for line annotations"); return(false); } if (Math.Abs(showScale - anno.ShowScale) > 0.001) { anno.ShowScale = showScale; } // Annotation height double height; if (!Double.TryParse(annoHeightTextBox.Text, out height)) { tabControl.SelectedTab = LineAnnotationTabPage; annoHeightTextBox.Focus(); MessageBox.Show("Cannot parse height for line annotations"); return(false); } if (Math.Abs(height - anno.Height) > 0.001) { anno.Height = height; } // What needs to be shown... anno.ShowAdjustedLengths = false; anno.ShowObservedLengths = false; if (annoAdjustedLengthsRadioButton.Checked) { anno.ShowAdjustedLengths = true; } else if (annoObservedLengthsRadioButton.Checked) { anno.ShowObservedLengths = true; } anno.ShowObservedAngles = observedAnglesCheckBox.Checked; return(true); }
/// <summary> /// Handles mouse-move. /// </summary> /// <param name="pos">The new position of the mouse</param> internal override void MouseMove(IPosition pos) { // If we previously drew a text outline, erase it now. EraseRect(); // Find the polygon (if any) that encloses the mouse position. CadastralMapModel map = CadastralMapModel.Current; ISpatialIndex index = map.Index; IPointGeometry pg = PointGeometry.Create(pos); Polygon enc = new FindPointContainerQuery(index, pg).Result; // If it's different from what we previously had, remember the // new enclosing polygon. if (!Object.ReferenceEquals(enc, m_Polygon)) { // If we had something before, and we filled it, erase // the fill now. //DrawPolygon(false); // Remember the polygon we're now enclosed by (if any). m_Polygon = enc; // Draw the new polygon. //DrawPolygon(true); // Ensure any calculated position has been cleared m_AutoPosition = null; // See if a new orientation applies CheckOrientation(pg); // If the enclosing polygon does not have a label, use the // standard cursor and fill the polygon. Otherwise use the // gray cursor. SetCommandCursor(); } // Draw a rectangle representing the outline of the text. if (m_IsAutoPos && m_Polygon != null) { if (m_AutoPosition == null) { m_AutoPosition = m_Polygon.GetLabelPosition(Width, Height); } } if (m_IsAutoPos && m_AutoPosition != null) { DrawText(m_AutoPosition); } else { DrawText(pos); } }
/// <summary> /// Attempts to resolves this forward reference. /// </summary> /// <param name="mapModel">The map model that should now contain the relevant features.</param> internal override void Resolve(CadastralMapModel mapModel) { Feature f = mapModel.Find <Feature>(InternalId); if (f == null) { throw new ApplicationException("Cannot locate forward reference " + InternalId); } ReferenceFrom.ApplyFeatureRef(Field, f); }
private void findButton_Click(object sender, EventArgs e) { try { CadastralMapModel mapModel = CadastralMapModel.Current; string s = idTextBox.Text; uint idValue = UInt32.Parse(s); Feature f = mapModel.Find <Feature>(new InternalIdValue(idValue)); if (f == null) { MessageBox.Show("Cannot find feature with ID=" + idValue); return; } EditingController.Current.Select(f); Position p = null; if (f is PointFeature) { p = new Position((f as PointFeature).PointGeometry); } else if (f is LineFeature) { p = new Position((f as LineFeature).StartPoint); } else if (f is TextFeature) { p = new Position((f as TextFeature).Position); } if (p == null) { MessageBox.Show("Cannot determine position for selected feature"); return; } ISpatialDisplay d = EditingController.Current.ActiveDisplay; if (d.MapScale > 2000.0) { d.MapScale = 2000.0; } d.Center = p; this.DialogResult = DialogResult.Cancel; Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
internal override void Resolve(CadastralMapModel mapModel) { foreach (ForwardRefArrayItem item in Items) { item.Feature = mapModel.Find<Feature>(item.InternalId); if (item.Feature == null) throw new ApplicationException("Cannot locate forward reference " + item.InternalId); } ReferenceFrom.ApplyFeatureRefArray(Field, Items); }
/// <summary> /// Initializes a new instance of the <see cref="Project"/> class /// upon creation of a brand new project. /// </summary> /// <param name="container">The container for this project (not null).</param> /// <param name="projectId">The unique ID for the project.</param> /// <param name="ps">The initial project settings (not null).</param> internal Project(ProjectDatabase container, Guid projectId, ProjectSettings ps) { if (container == null || ps == null) { throw new ArgumentNullException(); } m_Container = container; m_Id = projectId; m_Settings = ps; m_MapModel = new CadastralMapModel(); }
/// <summary> /// The scale at which points will start to draw. /// </summary> /* * uint m_ShowScale; * * FLOAT8 m_Height; // The height of point symbols, in * // meters on the ground. * LOGICAL m_ShowX; // TRUE if intersections should be * // displayed. */ /// <summary> /// True if changes to preferences will impact draws. /// </summary> //private bool m_IsRedrawRequired = false; /// <summary> /// True if the screen needs to be erased prior to redraw (e.g. if points /// need to be drawn smaller than they were). /// </summary> //private bool m_IsEraseRequired = false; public PreferencesForm() { InitializeComponent(); CadastralMapModel cmm = (CadastralMapModel)SpatialController.Current.MapModel; ShowPointsPage(cmm); ShowLabelsPage(cmm); ShowUnitsPage(cmm); ShowLineAnnotationPage(); ShowSymbologyPage(cmm); }
internal override void Resolve(CadastralMapModel mapModel) { foreach (ForwardRefArrayItem item in Items) { item.Feature = mapModel.Find <Feature>(item.InternalId); if (item.Feature == null) { throw new ApplicationException("Cannot locate forward reference " + item.InternalId); } } ReferenceFrom.ApplyFeatureRefArray(Field, Items); }
/* * void CdPrefLabel::OnFont() * { * CFontDialog dial; * dial.m_cf.Flags |= CF_TTONLY; // Only true-type fonts * dial.m_cf.Flags |= CF_FORCEFONTEXIST; // Font must exist(!) * dial.m_cf.Flags |= CF_SCALABLEONLY; // * dial.m_cf.Flags &= (~CF_EFFECTS); // No effects or colour * // dial.m_cf.Flags |= CF_WYSIWYG; // Same on printer * * // Check if there is a default font already. If so, make * // that display by default. * * LOGFONT LogFont; * CeMap* pMap = CeMap::GetpMap(); * CeFont* pFont = pMap->GetpFont(); * if ( pFont ) { * * // The height that gets defined relates to the * // nominal scale, which could be quite a bit different * // from the current draw scale. I tried changing this * // so that CFontDialog would initialize with the right * // point size, but MFC appears to select a point size * // that is double what I expect. To avoid the perception * // of a bug, lets just avoid the default on size. * * pFont->SetLogFont(LogFont); * LogFont.lfHeight = 0; * * dial.m_cf.lpLogFont = &LogFont; * dial.m_cf.Flags |= CF_INITTOLOGFONTSTRUCT; * } * * if ( dial.DoModal()==IDOK ) { * * // Define a font with the selected characteristics. * UINT4 ptsize = UINT4(dial.GetSize()); * CeFont font(dial.GetFaceName(),ptsize); * if ( dial.IsBold() ) font.SetBold(); * if ( dial.IsItalic() ) font.SetItalic(); * if ( dial.IsUnderline() ) font.SetUnderline(); * * // CHARS str[132]; * // sprintf ( str, "Point size=%lf Height=%lf", * // ptsize, ht ); * // AfxMessageBox(str); * * // Ensure the map has such a font and make it * // the default. * pMap->SetDefaultFont(font); * this->ShowFont(); * * } * * } // end of OnFont */ private void okButton_Click(object sender, EventArgs e) { CadastralMapModel cmm = (CadastralMapModel)SpatialController.Current.MapModel; if (SavePointsPage(cmm) && SaveLabelsPage(cmm) && SaveUnitsPage(cmm) && SaveLineAnnotationPage(cmm) && SaveSymbologyPage(cmm)) { this.DialogResult = DialogResult.OK; Close(); } }
/// <summary> /// Checks whether it is OK to undo the last edit in the current /// editing session. /// </summary> /// <exception cref="Exception">If there is any reason why it's inappropriate /// to undo at the present time</exception> internal void CheckUndo() { // If a check is running, confirm that we can really rollback (you can only undo // edits that you made since the check was started) if (m_Check != null) { CadastralMapModel map = CadastralMapModel.Current; uint lastop = map.LastOpSequence; if (!m_Check.CanRollback(lastop)) { throw new Exception("Cannot undo prior to beginning of File-Check"); } } }
bool SaveSymbologyPage(CadastralMapModel cmm) { int symScale; if (!Int32.TryParse(symScaleTextBox.Text, out symScale) || symScale < 0) { tabControl.SelectedTab = SymbologyTabPage; symScaleTextBox.Focus(); MessageBox.Show("Threshold scale for symbology is not valid"); return(false); } GlobalUserSetting.WriteInt("SymbologyScale", symScale); return(true); }
/// <summary> /// Applies any forward references that were detected during prior calls to <see cref="ReadFeatureRef"/> /// </summary> /// <exception cref="ApplicationException">If any forward reference could not be resolved.</exception> internal void ApplyForwardRefs() { CadastralMapModel model = MapModel; // Apply any forward splits (may create lines that are references in turn) foreach (ForwardSplit fwSplit in m_ForwardSplits) { fwSplit.Resolve(model); } foreach (ForwardRef fwRef in m_ForwardRefs) { fwRef.Resolve(model); } }
/// <summary> /// Executes the new label operation. /// </summary> /// <param name="vtx">The position of the new label.</param> /// <param name="polygonId">The ID and entity type to assign to the new label.</param> /// <param name="pol">The polygon that the label falls inside. It should not already refer to a label.</param> /// <param name="height">The height of the text, in meters on the ground.</param> /// <param name="width">The width of the text, in meters on the ground.</param> /// <param name="rotation">The clockwise rotation of the text, in radians from the horizontal.</param> internal void Execute(IPosition vtx, IdHandle polygonId, Polygon pol, double height, double width, double rotation) { // Add the label. CadastralMapModel map = MapModel; TextFeature text = map.AddKeyLabel(this, polygonId, vtx, height, width, rotation); SetText(text); // Associate the polygon with the label, and vice versa. text.SetTopology(true); pol.ClaimLabel(text); Complete(); }
/// <summary> /// Creates a new simple line segment. /// </summary> /// <param name="start">The point at the start of the new line.</param> /// <param name="end">The point at the end of the new line.</param> /// <remarks>When you add a new line segment, the two end points will be referenced both to the /// new line, and to the editing operation that defined the line. While this is a bit verbose, /// it's consistent.</remarks> internal void Execute(PointFeature start, PointFeature end) { // Disallow an attempt to add a null line. if (start.Geometry.IsCoincident(end.Geometry)) { throw new Exception("NewLineOperation.Execute - Attempt to add null line."); } // Add the new line with default entity type. CadastralMapModel mapModel = this.MapModel; LineFeature newLine = mapModel.AddLine(start, end, mapModel.DefaultLineType, this); base.SetNewLine(newLine); // Peform standard completion steps Complete(); }
/// <summary> /// Executes this operation. /// </summary> /// <param name="sub">The polygon subdivision information.</param> internal void Execute(PolygonSub sub) { int numLine = sub.NumLink; if (numLine == 0) { throw new Exception("PolygonSubdivisionOperation.Execute - Nothing to add"); } // If the polygon contains just one label, de-activate it. This covers a "well-behaved" situation, // where the label inside the polygon is likely to be redundant after the subdivision (it also // conforms to logic used in the past). In a situation where the polygon contains multiple labels, // it's less clear whether the labels become redundant or not, so we keep them all. Polygon pol = sub.Polygon; if (pol.LabelCount == 1) { m_Label = pol.Label; if (m_Label != null) { m_Label.IsInactive = true; } } // Mark the polygon for deletion pol.IsDeleted = true; // Get the default entity type for lines. CadastralMapModel map = MapModel; IEntity ent = map.DefaultLineType; // Allocate array to point to the lines we will be creating. m_Lines = new LineFeature[numLine]; // Add lines for each link PointFeature start, end; for (int i = 0; sub.GetLink(i, out start, out end); i++) { m_Lines[i] = map.AddLine(start, end, ent, this); } // Peform standard completion steps Complete(); }
/// <summary> /// Executes this operation. /// </summary> /// <param name="cps">The points to save (none of these should correspond to previously created /// features in the map model, otherwise an exception will be raised).</param> /// <param name="ent">The entity type to assign to control points</param> internal void Execute(ControlPoint[] cps, IEntity ent) { CadastralMapModel mapModel = CadastralMapModel.Current; foreach (ControlPoint cp in cps) { // Add a new point to the map & define it's ID PointFeature p = mapModel.AddPoint(cp, ent, this); // Create the new ID (and point the ID and feature to each other). string keystr = cp.ControlId.ToString(); ForeignId fid = new ForeignId(keystr); fid.Add(p); m_Features.Add(p); } Complete(); }
bool SaveLabelsPage(CadastralMapModel cmm) { ProjectSettings ps = EditingController.Current.Project.Settings; // Label threshold scale double labelScale; if (!Double.TryParse(labelScaleTextBox.Text, out labelScale)) { tabControl.SelectedTab = LabelsTabPage; labelScaleTextBox.Focus(); MessageBox.Show("Cannot parse threshold scale for text labels"); return(false); } if (Math.Abs(labelScale - ps.ShowLabelScale) > 0.001) { ps.ShowLabelScale = labelScale; } // Rotation angle (can't be changed via this dialog) // Nominal scale int nominalScale; if (!Int32.TryParse(nominalScaleTextBox.Text, out nominalScale) || nominalScale < 0) { tabControl.SelectedTab = LabelsTabPage; nominalScaleTextBox.Focus(); MessageBox.Show("Nominal scale for text labels is not valid"); return(false); } if (nominalScale != ps.NominalMapScale) { ps.NominalMapScale = (uint)nominalScale; } // TODO: Font return(true); }
bool SavePointsPage(CadastralMapModel cmm) { ProjectSettings ps = EditingController.Current.Project.Settings; // Point threshold scale double pointScale; if (!Double.TryParse(pointScaleTextBox.Text, out pointScale)) { tabControl.SelectedTab = PointsTabPage; pointScaleTextBox.Focus(); MessageBox.Show("Cannot parse threshold scale for points"); return(false); } if (Math.Abs(pointScale - ps.ShowPointScale) > 0.001) { ps.ShowPointScale = pointScale; } // Point size double pointSize; if (!Double.TryParse(pointSizeTextBox.Text, out pointSize)) { tabControl.SelectedTab = PointsTabPage; pointSizeTextBox.Focus(); MessageBox.Show("Cannot parse point size"); return(false); } if (Math.Abs(pointSize - ps.PointHeight) > 0.001) { ps.PointHeight = pointSize; } // Should intersections be drawn? ps.AreIntersectionsDrawn = showIntersectionsCheckBox.Checked; return(true); }
internal void Resolve(CadastralMapModel model) { IFeatureRef fr = m_LineRef.ReferenceFrom; Debug.Assert(fr is Operation); Feature f = model.Find<Feature>(m_LineRef.InternalId); if (f == null) throw new ApplicationException("Cannot locate forward reference " + m_LineRef.InternalId); // Only IntersectDirectionAndLineOperation has forward splits, so follow that logic LineFeature line = (LineFeature)f; var dff = new DeserializationFactory(fr as Operation); dff.AddLineSplit(line, DataField.SplitBefore, m_SplitBeforeId); dff.AddLineSplit(line, DataField.SplitAfter, m_SplitAfterId); IntersectOperation xop = (IntersectOperation)fr; LineFeature lineBefore, lineAfter; dff.MakeSections(line, DataField.SplitBefore, xop.IntersectionPoint, DataField.SplitAfter, out lineBefore, out lineAfter); }
/// <summary> /// Creates a new <c>FileCheckQuery</c> and executes it. /// </summary> /// <param name="model">The model to check</param> /// <param name="checks">Flag bits indicating the checks of interest</param> /// <param name="onCheckItem">Delegate to call whenever a further item is checked (null if no /// callback is required)</param> internal FileCheckQuery(CadastralMapModel model, CheckType checks, OnCheckItem onCheckItem) { if (model==null) throw new ArgumentNullException(); m_OnCheckItem = onCheckItem; m_Options = checks; m_NumCheck = 0; m_Result = new List<CheckItem>(100); ISpatialIndex index = model.Index; index.QueryWindow(null, SpatialType.Line, CheckLine); index.QueryWindow(null, SpatialType.Text, CheckText); index.QueryWindow(null, SpatialType.Polygon, CheckPolygon); // Do any post-processing. PostCheck(m_Result, true); m_Result.TrimExcess(); }
/// <summary> /// Creates a new <c>PolygonBuilder</c> for the supplied model. Make a subsequent /// call to <c>Build</c> to create polygons. /// </summary> /// <param name="model">The model the polygons should be created within.</param> internal PolygonBuilder(CadastralMapModel model) { m_Model = model; m_NewPolygonExtent = new Window(); m_Index = model.EditingIndex; }
bool SaveUnitsPage(CadastralMapModel cmm) { ProjectSettings ps = EditingController.Current.Project.Settings; if (enterMetersRadioButton.Checked) ps.EntryUnitType = DistanceUnitType.Meters; else if (enterFeetRadioButton.Checked) ps.EntryUnitType = DistanceUnitType.Feet; else if (enterChainsRadioButton.Checked) ps.EntryUnitType = DistanceUnitType.Chains; if (displayMetersRadioButton.Checked) ps.DisplayUnitType = DistanceUnitType.Meters; else if (displayFeetRadioButton.Checked) ps.DisplayUnitType = DistanceUnitType.Feet; else if (displayChainsRadioButton.Checked) ps.DisplayUnitType = DistanceUnitType.Chains; else if (displayAsEnteredRadioButton.Checked) ps.DisplayUnitType = DistanceUnitType.AsEntered; return true; }
bool SavePointsPage(CadastralMapModel cmm) { ProjectSettings ps = EditingController.Current.Project.Settings; // Point threshold scale double pointScale; if (!Double.TryParse(pointScaleTextBox.Text, out pointScale)) { tabControl.SelectedTab = PointsTabPage; pointScaleTextBox.Focus(); MessageBox.Show("Cannot parse threshold scale for points"); return false; } if (Math.Abs(pointScale - ps.ShowPointScale) > 0.001) { ps.ShowPointScale = pointScale; } // Point size double pointSize; if (!Double.TryParse(pointSizeTextBox.Text, out pointSize)) { tabControl.SelectedTab = PointsTabPage; pointSizeTextBox.Focus(); MessageBox.Show("Cannot parse point size"); return false; } if (Math.Abs(pointSize - ps.PointHeight) > 0.001) ps.PointHeight = pointSize; // Should intersections be drawn? ps.AreIntersectionsDrawn = showIntersectionsCheckBox.Checked; return true; }
bool SaveLabelsPage(CadastralMapModel cmm) { ProjectSettings ps = EditingController.Current.Project.Settings; // Label threshold scale double labelScale; if (!Double.TryParse(labelScaleTextBox.Text, out labelScale)) { tabControl.SelectedTab = LabelsTabPage; labelScaleTextBox.Focus(); MessageBox.Show("Cannot parse threshold scale for text labels"); return false; } if (Math.Abs(labelScale - ps.ShowLabelScale) > 0.001) ps.ShowLabelScale = labelScale; // Rotation angle (can't be changed via this dialog) // Nominal scale int nominalScale; if (!Int32.TryParse(nominalScaleTextBox.Text, out nominalScale) || nominalScale<0) { tabControl.SelectedTab = LabelsTabPage; nominalScaleTextBox.Focus(); MessageBox.Show("Nominal scale for text labels is not valid"); return false; } if (nominalScale != ps.NominalMapScale) ps.NominalMapScale = (uint)nominalScale; // TODO: Font return true; }
void ShowSymbologyPage(CadastralMapModel cmm) { int symScale = GlobalUserSetting.ReadInt("SymbologyScale", 5000); symScaleTextBox.Text = String.Format("{0:F0}", symScale); }
/// <summary> /// Attempts to resolves this forward reference. /// </summary> /// <param name="mapModel">The map model that should now contain the relevant features.</param> internal abstract void Resolve(CadastralMapModel mapModel);
bool SaveLineAnnotationPage(CadastralMapModel cmm) { LineAnnotationStyle anno = EditingController.Current.LineAnnotationStyle; // Annotation scale threshold double showScale; if (!Double.TryParse(annoScaleTextBox.Text, out showScale)) { tabControl.SelectedTab = LineAnnotationTabPage; annoScaleTextBox.Focus(); MessageBox.Show("Cannot parse scale threshold for line annotations"); return false; } if (Math.Abs(showScale - anno.ShowScale) > 0.001) anno.ShowScale = showScale; // Annotation height double height; if (!Double.TryParse(annoHeightTextBox.Text, out height)) { tabControl.SelectedTab = LineAnnotationTabPage; annoHeightTextBox.Focus(); MessageBox.Show("Cannot parse height for line annotations"); return false; } if (Math.Abs(height - anno.Height) > 0.001) anno.Height = height; // What needs to be shown... anno.ShowAdjustedLengths = false; anno.ShowObservedLengths = false; if (annoAdjustedLengthsRadioButton.Checked) anno.ShowAdjustedLengths = true; else if (annoObservedLengthsRadioButton.Checked) anno.ShowObservedLengths = true; anno.ShowObservedAngles = observedAnglesCheckBox.Checked; return true; }
/// <summary> /// Initializes a new instance of the <see cref="Project"/> class /// upon creation of a brand new project. /// </summary> /// <param name="container">The container for this project (not null).</param> /// <param name="projectId">The unique ID for the project.</param> /// <param name="ps">The initial project settings (not null).</param> internal Project(ProjectDatabase container, Guid projectId, ProjectSettings ps) { if (container == null || ps == null) throw new ArgumentNullException(); m_Container = container; m_Id = projectId; m_Settings = ps; m_MapModel = new CadastralMapModel(); }
bool SaveSymbologyPage(CadastralMapModel cmm) { int symScale; if (!Int32.TryParse(symScaleTextBox.Text, out symScale) || symScale<0) { tabControl.SelectedTab = SymbologyTabPage; symScaleTextBox.Focus(); MessageBox.Show("Threshold scale for symbology is not valid"); return false; } GlobalUserSetting.WriteInt("SymbologyScale", symScale); return true; }