You are here:GeoTux»Geo-Foros»cambiar color de un shape en MapWinGIS

Estadísticas

Invitados: 69
Usuarios registrados: 3232
Usuarios en línea:
-
Registrados hoy:
-

Registro

Redifusión (RSS)

Blogs y Noticias:
Recibe las actualizaciones en Geo-Noticias y Geo-Blogs

Recibir por e-mail
Recibir Geo-Noticias y Geo-Blogs por e-mail

¿Qué es esto?

Welcome, Guest
Username Password: Remember me

cambiar color de un shape en MapWinGIS
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: cambiar color de un shape en MapWinGIS

cambiar color de un shape en MapWinGIS 21 Ene 2010 05:17 #299

  • anonim3
  • OFFLINE
  • Visitante casual
  • Posts: 9
  • Karma: 0
Hola
desearía cambiar el color de el relleno, line o punto de un shape (trabajo en Visual Studio C# y MapWinGIS)
para ello se de la exsitencia de la función : .set_ShapeLayerFillColor(numshape, Uint32)
El problema lo tengo al coger un color de un ColorDialog, devuelve un objecto Color y necesito convertirlo correctamenta a UInt32.
Alguna idea de como hacer la conversión?

Gracias de antemano.

Re: cambiar color de un shape en MapWinGIS 21 Ene 2010 11:37 #300

  • tuxman
  • OFFLINE
  • Vive aquí
  • Posts: 285
  • Karma: 6
Prueba con:

System.Convert.ToUInt32( RGB( miColor.R, miColor.G, miColor.B ) )

Re: cambiar color de un shape en MapWinGIS 21 Ene 2010 12:23 #301

  • anonim3
  • OFFLINE
  • Visitante casual
  • Posts: 9
  • Karma: 0
Hola, gracias, pero eso ya lo intenté y me sale que RGB no existe...

Re: cambiar color de un shape en MapWinGIS 21 Ene 2010 13:26 #302

  • tuxman
  • OFFLINE
  • Vive aquí
  • Posts: 285
  • Karma: 6
Deberías encontrar la función RGB en el namespace Microsoft.VisualBasic.

Revisa en todo caso la documentación del framework que estás usando: 3.5, 2.0
Last Edit: 21 Ene 2010 13:33 by tuxman.

Re: cambiar color de un shape en MapWinGIS 16 Mar 2010 11:46 #339

  • sinuhe
  • OFFLINE
  • Visitante casual
  • Posts: 12
  • Karma: 0
la forma de asignarle colores a tus shapefiles depende si son poligonos, puntos o lineas.



te muestro un ejemplo

MapWinGIS:SampleCode-VB Net:ColorSelectedShapes
From MapWindow GIS
Jump to: navigation, search
Color Selected Shapes

' Example Code Created by Ted Dunsford on April 25, 2008
' This example illustrates how to change the fill color of
' selected shapes to cyan.
'
Public Class Form1

Dim layer As Integer
Dim sf As MapWinGIS.Shapefile

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AxMap1.SendSelectBoxFinal = True
AxMap1.SendMouseUp = True
AxMap1.CursorMode = MapWinGIS.tkCursorMode.cmSelection
End Sub

Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click

' Dimension a new shapefile
sf = New MapWinGIS.Shapefile

' Open the shapfile
Dim ofd As New OpenFileDialog
ofd.Filter = "Shapefiles (*.shp) |*.shp"
If Not ofd.ShowDialog(Me) = Windows.Forms.DialogResult.OK Then Return
sf.Open(ofd.FileName)

' Add the shapefile data to the map so that you can see it
layer = AxMap1.AddLayer(sf, True)

End Sub

Private Sub AxMap1_MouseUpEvent(ByVal sender As Object, ByVal e As AxMapWinGIS._DMapEvents_MouseUpEvent) Handles AxMap1.MouseUpEvent
Dim col As Color = AxMap1.get_ShapeLayerFillColor(layer)
Dim originalColor As UInt32 = col.B * 256 * 256 + col.G * 256 + col.R
' re-color the colored shapes the same color as the layer was colored originally
AxMap1.set_ShapeLayerFillColor(layer, originalColor)
AxMap1.set_ShapeLayerLineColor(layer, originalColor)
AxMap1.set_ShapeLayerPointColor(layer, originalColor)
End Sub

Private Sub AxMap1_SelectBoxFinal(ByVal sender As Object, ByVal e As AxMapWinGIS._DMapEvents_SelectBoxFinalEvent) Handles AxMap1.SelectBoxFinal
Dim ext As New MapWinGIS.Extents
Dim shapes() As Integer = Nothing
If sf Is Nothing Then Return
Dim top, left, bottom, right As Double

' Change the extents into geographic coordinates
AxMap1.PixelToProj(e.left, e.bottom, left, bottom)
AxMap1.PixelToProj(e.right, e.top, right, top)

' Set the region to control
ext.SetBounds(left, bottom, 0, right, top, 0)

If (sf.SelectShapes(ext, 0, MapWinGIS.SelectMode.INTERSECTION, shapes) = True) Then
' shapes is now an array of integers
Dim I As Integer
Dim cyan As UInt32 = 255 * 256 * 256 + 255 * 256

For I = 0 To shapes.Length - 1
' since the select box is smaller than the map, we already know the shapes selected are in the right place.
' This tests each shape to make sure that they have not had their "visible" property set to false.
If AxMap1.get_ShapeVisible(layer, shapes(I)) Then
' Color the shapes cyan

AxMap1.set_ShapeFillColor(layer, shapes(I), cyan)
AxMap1.set_ShapePointColor(layer, shapes(I), cyan)
AxMap1.set_ShapeLineColor(layer, shapes(I), cyan)
End If
Next
End If


End Sub
End Class



fuente: www.mapwindow.org/wiki/index.php/MapWinG...:ColorSelectedShapes


Saludos, SINUHE
  • Page:
  • 1
Time to create page: 1.35 seconds
 

¿Dónde nos leen?

Usuario aleatorio

Últimos Geo-Foros

No posts to display.

Últimos comentarios