Return to Homepage...
           
 

Welcome Guest Register Login Search The Forum Display List of Forum Members
 All Forums
  WishList
 
Subject Topic: Labels orientation Post Reply Post New Topic
Message posted by Daniel on 17 September 2002 at 10:14pm - IP Logged
View Daniel's Profile Search for other posts by Daniel Visit Daniel's Homepage Quote Daniel
Daniel
Gold Member
Gold Member
Argentina
03 July 2002
110 Posts

Yo estoy usando shapes del tipo "polylines" correspondientes al eje de calles de la ciudad de buenos aires. Todas las etiquetas que yo uso corresponden al nombre de las calles. 
En este contexto sería muy útil que las etiquetas se orienten según la línea que está designando. 

 


¿Algun comentario? 
 
I am using "polylines" shapes corresponding to the axis of streets of the city. All the labels that I use correspond to the street's names.   
In this context it would be very useful that the labels are guided according to the line that is designating.   
   
Any comments?


Message posted by Daniel on 27 September 2002 at 4:35pm - IP Logged
View Daniel's Profile Search for other posts by Daniel Visit Daniel's Homepage Quote Daniel
Daniel
Gold Member
Gold Member
Argentina
03 July 2002
110 Posts

Sorry, the image is:

Any coments?

Daniel


Message posted by Pedro on 27 September 2002 at 11:32pm - IP Logged
View Pedro's Profile Search for other posts by Pedro Quote Pedro
Pedro
Forum Admin
Forum Administrator
Italy
30 March 2001
249 Posts

Hi Daniel

Yes .. this is a common request users make, and by the way was subject of some debate a month ago with John and Erwin.

To achieve this I've planned the change in the Paint object for a STYLE property that will work as CSS in HTML -  in a cascading logic of styles. I already launched a 1st working version (for delphi and kylix) of a style parser but I didn't had the time to include that in the inovaGIS library (and I'll not have the time to do so in the following weeks). Nevertheless search the forum for those posts because some of the questions are still valid, like for example, how should we calculate the angle of the text, should it the average between the different segments ? or the starting and ending point ? ...

all the best

Pedro


Message posted by AJAM on 14 April 2003 at 8:33pm - IP Logged
View AJAM's Profile Search for other posts by AJAM Quote AJAM
AJAM
Avatar
Standard Member
Standard Member
Mexico
07 April 2003
21 Posts

The angle of street label should be that of the longest segment visible; if street A changes angle in the middle of the display then you could simply select the angle of the first segment and apply the label there. Which is what I do now: take the street's name from the DB, put it into a label, then angle the label, so it's not part of the gis object but rather pasted over it. Consumes a lot of resources, though...


Message posted by Erwin on 17 April 2003 at 8:05pm - IP Logged
View Erwin's Profile Search for other posts by Erwin Visit Erwin's Homepage Quote Erwin
Erwin
Avatar
Platinum Member
Platinum Member
Netherlands
26 June 2002
186 Posts

Hey,... AJAM,... i see you did get the labels working ?

To contribute,... post your code and let other people give their comments,...

More people, have more ideas,... and i  ideas :)



-------------
** still looking for the code to crack my safe **

Message posted by geored on 17 April 2003 at 9:00pm - IP Logged
View geored's Profile Search for other posts by geored Quote geored
geored
Avatar
Standard Member
Standard Member
Mexico
17 September 2002
18 Posts

sorry it's in spanish, i'll try to transalte it...

Para rotar una etiqueta es necesario que en la capa a etiquetar tengan un campo con el angulo de rotación en grados, tambien debemos tener su centroide si queremos la etiqueta al centro...

El Código esta en VB6...

Declaren en un modulo estas llamadas a la API de Windows:
---------------------

English:

To rotate a label its needed a field that contains the angle in degrees, also u need the center of the object...

Te code is in VB6...

Declare a Module with this API Calls...

----------------------

Public Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long

   Public Declare Function CreateFontIndirect Lib "gdi32" Alias _
     "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
   Private Const LF_FACESIZE = 32

   Public Type LOGFONT
     lfHeight As Long
     lfWidth As Long
     lfEscapement As Long
     lfOrientation As Long
     lfWeight As Long
     lfItalic As Byte
     lfUnderline As Byte
     lfStrikeOut As Byte
     lfCharSet As Byte
     lfOutPrecision As Byte
     lfClipPrecision As Byte
     lfQuality As Byte
     lfPitchAndFamily As Byte
     lfFaceName As String * LF_FACESIZE
   End Type

 

Despues declaren esta rutina:

------

Then declare this routine:

-------------

' ---
' Función que despliega un texto en un PictureBox, con una rotación dada
' ---
' Parámetros:
'
'   hndx : Picturebox sobre el cual se dibujará el texto
' px, py : Posición en x, y del texto en PIXELES
' angulo : Angulo de inclinación del texto en GRADOS
'    tam : Tamaño del texto
'  color : Color del Texto en Hexadecimal
'  texto : TEXTO a dibujar
' ---
' NOTA: Se utiliza el tipo de letra ARIAL, en formato REGULAR
' ---
' Carlos Meda

Public Sub PonTexto(hndx As PictureBox, Px As Double, Py As Double, Angulo As Double, tam As Integer, Color As String, texto As String)
     Dim font As LOGFONT
     Dim prevFont As Long, hFont As Long, ret As Long
     Dim AuxX As Double
     Dim AuxY As Double
     Dim FacXAngulo As Double
     Dim FacYAngulo As Double
     font.lfEscapement = Angulo * 10  ' rotacion en grados

     font.lfFaceName = "Arial" & Chr$(0) 'Caracter nulo al final
    ' Windows espera que el tamaño de la fuente esté en pixeles y que sea negativo
     ' si estas especificando la altura de los caracteres
     font.lfHeight = (tam * -10) '/ Screen.TwipsPerPixelY
     hFont = CreateFontIndirect(font)
     prevFont = SelectObject(hndx.hdc, hFont)
     If Angulo >= 0 And Angulo <= 90 Then
        FacYAngulo = Angulo / 90
        FacXAngulo = (90 - Angulo) / 90
        AuxX = (Len(texto) / 2) * FacXAngulo * 8
        AuxY = (Len(texto) / 2) * FacYAngulo * 5
        hndx.CurrentX = Px - AuxX
        hndx.CurrentY = Py + AuxY

    Else
        FacXAngulo = Angulo / 360
        FacYAngulo = (360 - Angulo) / 90
        AuxX = (Len(texto) / 2) * FacXAngulo * 6
        AuxY = (Len(texto) / 2) * FacYAngulo * 12
        hndx.CurrentX = Px - AuxX
        hndx.CurrentY = Py - AuxY

     End If
    
     hndx.Print texto
     ' restauramos la fuente original.
     ret = SelectObject(hndx.hdc, prevFont)
     ret = DeleteObject(hFont)
     'hndx.CurrentY = hndx.ScaleHeight / 2
     'hndx.Print "Texto Normal"

End Sub

La rutina se ejecuta para cada registro que queramos etiquetar...

----

The routine runs for each record we want to label...

 

Any comments?????


If you wish to post a reply to this thread you must first Login
If you are not already registered you must first register

Forum Jump Post Reply Post New Topic
Printable version Printable version

Powered by Web Wiz Forums version 6.25
Copyright ©2001-2002 Web Wiz Guide


Banner Exchange by Exchange-it