/// <summary>
        /// DEVUELVE LA N-ENTIDADES MAS CERCANAS DE UN TEMA A LA LOCALIZACIÓN
        /// </summary>
        /// <param name="Theme">CÓDIGO DEL TEMA DONDE SE BUSCAN LAS ENTIDADES</param>
        /// <param name="Filter">FILTRO ALFANUMÉRICO SOBRE EL TEMA (PUEDE SER VACIO)</param>
        /// <param name="MaxEntities">NÚMERO DE ENTIDADES MÁS CERCANAS A BUSCAR</param>
        /// <param name="Entities">ARRAY CON LAS ENTIDADES MÁS CERCANAS ENCONTRADAS</param>
        /// <param name="Distances">ARRAY CON LAS DISTANCIAS A CADA ENTIDAD</param>
        /// <returns></returns>
        public bool GetClosestEntities(string Theme, string Filter, short MaxEntities, ref geOS_MapEntity[] Entities, ref double[] Distances)
        {
            byte[] bIdEntidades = new byte[MaxEntities * sizeof(Int32)];
            byte[] bDistances   = new byte[MaxEntities * sizeof(double)];

            if (geOS_Gestor.GetEntidadesMasCercanas(this.Map.Connection.ConnectionId, this.Map.MapId, this._nIdLoc,
                                                    MaxEntities, Theme, Filter, bIdEntidades, bDistances) == 0)
            {
                return(false);
            }

            int[] IdEntidades = new int[MaxEntities];

            for (int i = 0; i < MaxEntities; i++)
            {
                IdEntidades[i] = BitConverter.ToInt32(bIdEntidades, i * 4);
                Distances[i]   = BitConverter.ToDouble(bDistances, i * 8);
            }

            for (int i = 0; i < MaxEntities; i++)
            {
                Entities[i] = new geOS_MapEntity(this.Map.Connection, IdEntidades[i]);
            }

            return(true);
        }
Example #2
0
        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);

            // LOS MENSAJES ENVIADOS POR EL MOTOR EMPIEZAN EN 0x4200
            if (m.Msg >= 0x4200)
            {
                geOS_Message msg = (geOS_Message)m.Msg;

                if (msg == geOS_Message.msgInfoEntity)
                {
                    geOS_MapEntity Entidad = new geOS_MapEntity(this._Conexion, (int)m.LParam);
                    OnEntityInfo(Entidad);
                }
                else if (msg == geOS_Message.msgBeforeMapDraw && this.OnBeforeMapDraw != null)
                {
                    OnBeforeMapDraw();
                }
                else if (msg == geOS_Message.msgAfterMapDraw && this.OnAfterMapDraw != null)
                {
                    OnAfterMapDraw();
                }
                else if (msg == geOS_Message.msgCanceledMapDraw && this.OnCancelledMapDraw != null)
                {
                    OnCancelledMapDraw();
                }
                else if (msg == geOS_Message.msgMapClick && this.OnMapClick != null)
                {
                    OnMapClick((int)m.WParam, (int)m.LParam);
                }
                else if (msg == geOS_Message.msgChangeView && this.OnChangeView != null)
                {
                    OnChangeView(Marshal.PtrToStringAnsi(m.LParam));
                }
                else if (msg == geOS_Message.msgEditionInit && this.OnEditionInit != null)
                {
                    OnEditionInit();
                }
                else if (msg == geOS_Message.msgEditionFinished && this.OnEditionFinished != null)
                {
                    OnEditionFinished();
                }
                else if (msg == geOS_Message.msgEditionSaved && this.OnEditionSaved != null)
                {
                    OnEditionSaved();
                }
                else if (msg == geOS_Message.msgUndo && this.OnEditionUNDO != null)
                {
                    OnEditionUNDO((int)m.WParam);
                }
                else if (msg == geOS_Message.msgGetGeocode && this.OnGetGeocode != null)
                {
                    geOS_MapEntity entity      = new geOS_MapEntity(this.Connection, (int)m.WParam);
                    string         sNewGeocode = Marshal.PtrToStringAnsi(m.LParam);

                    bool bRetorno = OnGetGeocode(entity, ref sNewGeocode);

                    // Resultado del mensaje...
                    m.Result = new IntPtr(bRetorno ? 1 : 0);

                    if (bRetorno && sNewGeocode != Marshal.PtrToStringAnsi(m.LParam))
                    {
                        System.IO.MemoryStream memStream = new System.IO.MemoryStream(sNewGeocode.Length + 1);

                        memStream.Write(Encoding.ASCII.GetBytes(sNewGeocode), 0, sNewGeocode.Length);
                        memStream.WriteByte((byte)0);

                        Marshal.Copy(memStream.ToArray(), 0, m.LParam, sNewGeocode.Length + 1);
                    }
                }
            }
        }
Example #3
0
 /// <summary>
 /// DIBUJA UN TEXTO ASOCIADO A UNA ENTIDAD EN EL MARCO DEL MGI QUE SE PASA COMO PARAMETRO
 /// </summary>
 /// <param name="sKey">CLAVE DEL MARCO EN EL MGI</param>
 /// <param name="Entity">ENTIDAD CUYO TEXTO SE DESEA PINTAR</param>
 /// <param name="sText">TEXTO</param>
 /// <param name="sFont">FUENTE DE LETRA</param>
 /// <param name="TextColor">COLOR DEL TEXTO</param>
 /// <param name="MMsSize">TAMAÑO EN MILIMETROS DEL TEXTO</param>
 /// <param name="OffsetFactor">USADO EN EL CASO DE PINTAR TEXTOS ASOCIADOS A ENTIDADES PUNTUALES
 ///                            DEFINE EL FACTOR DE OFFSET DONDE SERA DIBUJADO EL TEXTO RESPECTO AL TAMAÑO DEL PUNTO
 /// </param>
 /// <returns></returns>
 public bool PlotDrawEntityText(string sKey, geOS_MapEntity Entity, string sText, string sFont, Color TextColor, double MMsSize, double OffsetFactor)
 {
     return(geOS_Gestor.ImpresoPintarTextoEntidad(_IdConexion, sKey, Entity.Id, sFont, sText, TextColor.ToArgb(), MMsSize, OffsetFactor) == 0 ? false : true);
 }
Example #4
0
 /// <summary>
 /// DIBUJA UNA ENTIDAD EN EL MARCO DEL MGI QUE SE PASA COMO PARAMETRO
 /// </summary>
 /// <param name="sKey">CLAVE DEL MARCO EN EL MGI</param>
 /// <param name="Entity">ENTIDAD QUE SE DESEA PINTAR</param>
 /// <param name="BackColor">COLOR DE FONDO</param>
 /// <param name="FillStyle">ESTILO DE RELLENO (SI LA ENTIDAD ES POLIGONAL)</param>
 /// <param name="EdgeColor">COLOR DE BORDE (SI LA ENTIDAD ES POLIGONAL)</param>
 /// <param name="Size">ANCHO EN UNIDADES DE DIBUJO DEL BORDE</param>
 /// <returns></returns>
 public bool PlotDrawEntity(string sKey, geOS_MapEntity Entity, Color BackColor, geOS_FillType FillStyle, Color EdgeColor, short Size)
 {
     return(geOS_Gestor.ImpresoPintarEntidad(_IdConexion, sKey, Entity.Id, BackColor.ToArgb(), (short)FillStyle, EdgeColor.ToArgb(), Size) == 0 ? false : true);
 }
 /// <summary>
 /// DEVUELVE LA DISTANCIA DE ESTA LOCALIZACIÓN A UNA ENTIDAD
 /// </summary>
 /// <param name="Entity">ENTIDAD</param>
 /// <returns></returns>
 public double DistanceToEntity(geOS_MapEntity Entity)
 {
     return(geOS_Gestor.DistanciaLocalizacionEntidad(this.Map.Connection.ConnectionId, this.Map.MapId, this._nIdLoc, Entity.Id));
 }