Exemplo n.º 1
0
        //---------------------------------------------------------------------------
        public bool GenereItem(
            object obj,
            double fLat,
            double fLong, CMapLayer layer)
        {
            CResultAErreur result             = CResultAErreur.True;
            CContexteEvaluationExpression ctx = new CContexteEvaluationExpression(this.m_mapItemGenerator);

            if (FormuleCondition != null && !(FormuleCondition is C2iExpressionVrai))
            {
                result = FormuleCondition.Eval(ctx);
                if (!result || result.Data == null)
                {
                    return(false);
                }
                bool?bResult = CUtilBool.BoolFromString(result.Data.ToString());
                if (bResult == null || !bResult.Value)
                {
                    return(false);
                }
            }
            string strLibelle = "";

            if (FormuleToolTip != null)
            {
                result = FormuleToolTip.Eval(ctx);
                if (result && result.Data != null)
                {
                    strLibelle = result.Data.ToString();
                }
            }
            IMapItem item = null;

            if (MarkerType != EMapMarkerType.none)
            {
                item = new CMapItemSimple(layer, fLat, fLong, MarkerType);
            }
            else if (Image != null)
            {
                if (layer.Database.GetImage(m_strImageId) == null)
                {
                    layer.Database.AddImage(m_strImageId, Image);
                }
                item = new CMapItemImage(layer, fLat, fLong, m_strImageId);
            }
            else
            {
                item = new CMapItemSimple(layer, fLat, fLong, EMapMarkerType.green);
            }
            item.Tag              = obj;
            item.ToolTip          = strLibelle;
            item.PermanentToolTip = PermanentToolTip;

            if (ItemGenerator.ActionSurClick != null)
            {
                item.MouseClicked += new MapItemClickEventHandler(OnMouseClick);
            }

            return(true);
        }
Exemplo n.º 2
0
        //---------------------------------------------------------------------------
        public bool GenereItem(
            object obj,
            double fLat1,
            double fLong1,
            double fLat2,
            double fLong2,
            CMapLayer layer)
        {
            CResultAErreur result             = CResultAErreur.True;
            CContexteEvaluationExpression ctx = new CContexteEvaluationExpression(this.m_mapLineGenerator);

            if (FormuleCondition != null && !(FormuleCondition is C2iExpressionVrai))
            {
                result = FormuleCondition.Eval(ctx);
                if (!result || result.Data == null)
                {
                    return(false);
                }
                bool?bResult = CUtilBool.BoolFromString(result.Data.ToString());
                if (bResult == null || !bResult.Value)
                {
                    return(false);
                }
            }
            string strLibelle = "";

            if (FormuleToolTip != null)
            {
                result = FormuleToolTip.Eval(ctx);
                if (result && result.Data != null)
                {
                    strLibelle = result.Data.ToString();
                }
            }


            CMapItemPath line = new CMapItemPath(layer);

            line.LineColor        = LineColor;
            line.LineWidth        = LineWidth;
            line.ToolTip          = strLibelle;
            line.PermanentToolTip = m_bPermanentToolTip;
            line.Tag = obj;
            List <SLatLong> lstPts = new List <SLatLong>();

            lstPts.Add(new SLatLong(fLat1, fLong1));
            //lstPts.Add(new SLatLong((fLat1 + fLat2) / 2, (fLong1 + fLong2) / 2));
            lstPts.Add(new SLatLong(fLat2, fLong2));
            line.Points = lstPts;

            if (LineGenerator.ActionSurClick != null)
            {
                line.MouseClicked += new MapItemClickEventHandler(OnMouseClick);
            }


            return(true);
        }