VERSION 5.00 Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} Lot_ScaleForm Caption = "Масштаб" ClientHeight = 1455 ClientLeft = 45 ClientTop = 345 ClientWidth = 2520 OleObjectBlob = "Lot_ScaleForm.frx":0000 StartUpPosition = 1 'CenterOwner End Attribute VB_Name = "Lot_ScaleForm" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Public LayersColl As New Collection Public MC As MapContainer Public CurrentSquare As Double Dim CurentScaleIndex As Integer Public Sub SaveVisibleLayers(Layer As Object) Dim L As FolderLayer If Layer.Visible Then LayersColl.Add (Layer.SeqID) If TypeOf Layer Is FolderLayer Then Set L = Layer For i = 0 To L.LayerCount - 1 Call SaveVisibleLayers(L.Layers(i)) Next i End If End Sub Sub VisibleOffLayers(Layer As Object) Dim L As Object If Not (TypeOf Layer Is ImageLayer) Then If Not Layer.Parent Is Nothing Then Layer.Visible = False End If End If If TypeOf Layer Is FolderLayer Then Set L = Layer For i = 0 To L.LayerCount - 1 Set L = Layer Call VisibleOffLayers(L.Layers(i)) Next i End If End Sub Public Sub RestoreVisibleLayers(Map As Map) Call VisibleOffLayers(Map.Layers) For i = 2 To LayersColl.Count Map.LayerBySeqID(LayersColl.item(i)).Visible = True Next i End Sub Private Sub CommandButton1_Click() Lot_ScaleForm.Hide Module.kx = Module.kx_ Module.ky = Module.ky_ Module.kx = ActiveMapEditor.ProjectMap.Depository.Value("HorCoefficient") Module.ky = ActiveMapEditor.ProjectMap.Depository.Value("VerCoefficient") Set MC = ActiveMapContainer Dim al As VectorLayer Set al = ActiveLayer Dim s As Double CurentScaleIndex = ComboBox1.ListIndex Select Case CurentScaleIndex Case 0: s = 1 / 100 Case 1: s = 1 / 200 Case 2: s = 1 / 500 Case 3: s = 1 / 1000 Case 4: s = 1 / 2000 Case 5: s = 1 / 5000 Case 6: s = 1 / 10000 Case 7: s = 1 / 20000 End Select Set Module.CurrentFeature = ActiveMapContainer.EditedFeature Module.Масштаб = s Module.ScaleStr = ComboBox1.Text If Not ActiveMapContainer.EditedFeature.AsCovArea Is Nothing Then Dim Sh As CovArea 'Dim Points As MapPolyPoints Set Sh = ActiveMapContainer.EditedFeature.AsCovArea ' ValC = 0 ' For i = 0 To Sh.PartNumber - 1 ' If Abs(Sh.Points(ValC).X - Sh.Points(ValC + Sh.PartCounts(i) - 1).X) < 0.0001 And _ ' Abs(Sh.Points(ValC).Y - Sh.Points(ValC + Sh.PartCounts(i) - 1).Y) < 0.0001 Then ' Sh.PartCounts(i) = Sh.PartCounts(i) - 1 ' End If ' ValC = ValC + Sh.PartCounts(i) ' Next i 'CurrentSquare = Sh.Square End If Module.EGRZ.PlotLayer = ActiveLayer Dim lll As VectorLayer Set lll = ActiveLayer lll.Visible = False Call Module.EGRZ.DrawPlotToMap(ActiveLayer, ActiveMapContainer.EditedFeature, s * 0.9, 500, 500, "") 'ActiveMapContainer.RefreshLegends Set ReportMapExtentRect = ActiveMap.FullExtent Dim gl As GraphicLayer Set gl = ActiveMap.Layers.Layers(0) gl.Drawing.Precision = 0.1 If CheckBox1.Value Then On Error Resume Next 'For i = 0 To gl.Drawing.ItemCount - 1 ' gl.Drawing.Items(i).ExDrawRecord.ContourColor = 255 ' gl.Drawing.Items(i).ExDrawRecord.BkColor = 255 ' gl.Drawing.Items(i).ExDrawRecord.Colors(0) = 255 ' gl.Drawing.Items(i).ExDrawRecord.Colors(1) = 255 ' gl.Drawing.Items(i).Color = 255 'Next i On Error GoTo 0 Dim item As MapviewItem Set item = gl.PlaceItem(16) item.Transparent = True ActiveMap.RefreshContainers Set item.MapRect = MC.EditedFeature.Bounds 'ActiveMap.FullExtent item.Resolution = 600 'Dim r As New MapRect 'Set r = item.MapRect item.Location.Corner(0).X = item.MapRect.Xmin item.Location.Corner(0).Y = item.MapRect.Ymax item.Location.Corner(1).X = item.MapRect.Xmin item.Location.Corner(1).Y = item.MapRect.Ymin item.Location.Corner(2).X = item.MapRect.Xmax item.Location.Corner(2).Y = item.MapRect.Ymin With item .Scale = s End With item.WithFrames = False item.UpdateBounds For i = LayersColl.Count To 1 Step -1 LayersColl.Remove (i) Next i Call SaveVisibleLayers(MC.Map.Layers) 'Call VisibleOffLayers(MC.Map.Layers) 'MC.Map.Layers.Visible = True MC.Map.LayerByName("Растры").Visible = False MC.EditedFeature.Selected = False 'Call item.UpdatePicture(MC) Dim Shp As New PolygonShape Dim SavedReg As New PolygonShape Set SavedReg = MC.Map.Layers.ClipRegion.Region Set Shp = MC.EditedFeature.AsCovArea.AsPolygon ' Set Points = MC.EditedFeature.Layer.Coverage.GetCovAreaPoints(MC.EditedFeature.AsCovArea) ' Shp.PartNumber = Points.PartNumber ' For j = 0 To Points.PartNumber - 1 ' Shp.PartCounts(j) = Points.PartCounts(j) ' Next j ' For j = 0 To Points.PointNumber - 1 ' Set Shp.Points(j) = Points.Points(j) ' Next j Shp.UpdateBounds Set MC.Map.Layers.ClipRegion.Region = Shp Dim LabelLayer As GraphicLayer Dim IsLabelLayerVisible As Boolean Set LabelLayer = MC.Map.LayerByName("Разметка") If Not LabelLayer Is Nothing Then IsLabelLayerVisible = LabelLayer.Visible: LabelLayer.Visible = False Call item.UpdatePicture(MC) If Not LabelLayer Is Nothing Then LabelLayer.Visible = IsLabelLayerVisible Call MC.Map.Layers.ClipRegion.Clear 'Set SavedReg = MC.Map.Layers.ClipRegion.Region MC.EditedFeature.Selected = True MC.Map.LayerByName("Растры").Visible = True 'Call RestoreVisibleLayers(MC.Map) 'MC.Map.Layers.Visible = True Dim PPP As New ModelPoint PPP.X = (item.Bounds.Xmin + item.Bounds.Xmax) / 2 PPP.Y = (item.Bounds.Ymax + item.Bounds.Ymin) / 2 Call gl.ExecuteFeatureVerb(gl.ItemAsFeature(item), ActiveMapContainer, 6, PPP) If Not LabelLayer Is Nothing Then If LabelLayer.Visible Then Dim it As item Dim DimIt As DimensionItem Dim col As New IndorGIS.Collection Dim r As ModelRect item.UpdateBounds Set r = item.Bounds Set col = LabelLayer.GetFeaturesAtRect(r) For i = 0 To col.Count - 1 Set it = col.Items(i).AsItem If TypeOf it Is DimensionItem Then Set DimIt = gl.PlaceItem(it.DefID) DimIt.Color = it.Color 'DimIt.DefID = it.DefID 'DimIt.Flags = it.Flags DimIt.HideLines = it.HideLines DimIt.Size = it.Size DimIt.TextLocation = it.TextLocation DimIt.TextAboveLine = it.TextAboveLine DimIt.TextBelowLine = it.TextBelowLine DimIt.SetPoints it.Points(0).X, it.Points(0).Y, it.Points(1).X, it.Points(1).Y, _ it.Points(2).X, it.Points(2).Y, it.Points(3).X, it.Points(3).Y DimIt.UpdateBounds End If Next i End If End If End If 'Set ActiveMapContainer.CurrentLayer = ActiveMap.Layers.Layers(0) 'Set gl = ActiveLayer 'gl.Drawing.Precision = 0.1 lll.Visible = True Dim rrr As New FlatRect rrr.Xmax = ActiveMap.FullExtent.Xmax: rrr.Xmin = ActiveMap.FullExtent.Xmin rrr.Ymax = ActiveMap.FullExtent.Ymax: rrr.Ymin = ActiveMap.FullExtent.Ymin Call ActiveMapContainer.ZoomToExtent(rrr) MC.RefreshContent True End Sub Private Sub CommandButton2_Click() Lot_ScaleForm.Hide End Sub Private Sub Frame1_Click() End Sub Private Sub UserForm_Activate() h = 0.2 / (Abs(ActiveMapContainer.SelectionExtent.Height)) w = 0.2 / (ActiveMapContainer.SelectionExtent.Width) If h < w Then w = h If ComboBox1.ListIndex = -1 Then ComboBox1.ListIndex = 3 ' ComboBox1.ListIndex = 7 ' If w > 1 / 10000 Then ComboBox1.ListIndex = 6 ' If w > 1 / 5000 Then ComboBox1.ListIndex = 5 ' If w > 1 / 2000 Then ComboBox1.ListIndex = 4 ' If w > 1 / 1000 Then ComboBox1.ListIndex = 3 ' If w > 1 / 500 Then ComboBox1.ListIndex = 2 ' If w > 1 / 200 Then ComboBox1.ListIndex = 1 ' If w > 1 / 100 Then ComboBox1.ListIndex = 0 ' ComboBox1.ListIndex = 3 End Sub Private Sub UserForm_Initialize() CurentScaleIndex = 3 With ComboBox1 .AddItem "1 : 100" .AddItem "1 : 200" .AddItem "1 : 500" .AddItem "1 : 1 000" .AddItem "1 : 2 000" .AddItem "1 : 5 000" .AddItem "1 : 10 000" .AddItem "1 : 20 000" ComboBox1.ListIndex = CurentScaleIndex End With End Sub