예제 #1
0
        /// <summary>
        /// save as bmp file
        /// </summary>
        /// <param name="n"></param>
        /// <returns>Bitmap of current Node and children</returns>
        public Bitmap drawTree(Node n)
        {
            Bitmap   b;
            Graphics g;

            Options.OptionsData d = Options.OptionsData.Instance;
            // set drawing options
            justification       = d.Justification;
            join                = d.Join;
            treeOrientation     = d.TreeOrientation;
            useRnotation        = d.Notation;
            dropShadow          = d.DropShadow;
            boxShading          = d.BoxShading;
            showLegend          = d.ShowLegend;
            arrows              = d.Arrow;
            marker              = d.Marker;
            helpersAsCoPremises = d.HelpersAsCoPremises;
            // Width and height calculation should only be a cross check
            maxWidth  = 0;
            maxHeight = 0;

            recalc(n);

            b = new Bitmap((int)maxWidth + 20, (int)maxHeight + 20); // 20 pixel border
            g = Graphics.FromImage(b);                               // gets the graphics drawing object
            g.Clear(Color.White);                                    // clears the background
            drawTree(g, n);

            return(b);
        }
예제 #2
0
        public List <address> getAllAddress(markerType type)
        {
            List <address> li  = new List <address>();
            SQLiteCommand  cmd = new SQLiteCommand(m_con);

            if (type == markerType.source)
            {
                cmd.CommandText = "select * from send";
            }
            else
            {
                cmd.CommandText = "select * from recv";
            }
            SQLiteDataReader dr = cmd.ExecuteReader();
            StringBuilder    sb = new StringBuilder();

            while (dr.Read())
            {
                address one = new address();
                one.name    = dr.GetString(0);
                one.pos.Lat = dr.GetDouble(1);
                one.pos.Lng = dr.GetDouble(2);
                li.Add(one);
            }
            return(li);
        }
예제 #3
0
        /// <summary>
        /// Draws the tree from the specified node
        /// </summary>
        /// <param name="g">The Drawing GDI object</param>
        /// <param name="n">Root Node</param>
        public void drawTree(Graphics g, Node n)
        {
            graphics = g;

            Options.OptionsData d = Options.OptionsData.Instance;
            // set drawing options
            justification       = d.Justification;
            join                = d.Join;
            treeOrientation     = d.TreeOrientation;
            useRnotation        = d.Notation;
            dropShadow          = d.DropShadow;
            boxShading          = d.BoxShading;
            showLegend          = d.ShowLegend;
            arrows              = d.Arrow;
            marker              = d.Marker;
            helpersAsCoPremises = d.HelpersAsCoPremises;
            // Width and height calculation should only be a cross check
            maxWidth    = 0;
            maxHeight   = 0;
            g.PageScale = zoom;

            // if(needsRecalc)
            recalc(n);

            // calcStartXY(n,ref x,ref y);

            // for debug
            // g.DrawRectangle(new Pen(Color.Bisque),0,0,maxWidth,maxHeight);
            // g.DrawString("maxHeight & maxWidth:"+maxWidth+" : "+maxHeight,new Font("Courier",8F),new SolidBrush(Color.Black),offsetX,offsetY+maxHeight+margin);

            drawNode(n.x, n.y, n, 0);

            legendY = maxHeight - legendHeight;
            drawLegend(n, true);
        }
예제 #4
0
 public void addAddress(address addr, markerType type)
 {
     if (type == markerType.source)
     {
         send_comBox.Items.Add(addr.name);
     }
     else
     {
         recv_comBox.Items.Add(addr.name);
     }
     m_map.addMarker(addr.pos, addr.name, type);
 }
예제 #5
0
 public void intoAddStatus(markerType addrType)
 {
     if (addrType == markerType.source)
     {
         RSFlag = markerType.source;
     }
     if (addrType == markerType.destination)
     {
         RSFlag = markerType.destination;
     }
     addFlag             = true;
     okButton.Visible    = true;
     cacelButton.Visible = true;
 }
예제 #6
0
        public void deleteAddress(address addr, markerType type)
        {
            string str = "";

            if (type == markerType.source)
            {
                str = "delete from send where name=" + "'" + addr.name + "'";
            }
            else
            {
                str = "delete from recv where name=" + "'" + addr.name + "'";
            }
            excuteCommand(str);
        }
예제 #7
0
        public void insertAddress(address addr, markerType type)
        {
            string str = "";

            if (type == markerType.source)
            {
                str = "insert into send (name, lat, lon) values ('" + addr.name + "', " + addr.pos.Lat + ", " + addr.pos.Lng + ")";
            }
            else
            {
                str = "insert into recv (name, lat, lon) values ('" + addr.name + "', " + addr.pos.Lat + ", " + addr.pos.Lng + ")";
            }
            excuteCommand(str);
        }
 public void addMarker(PointLatLng p, string name, markerType type)
 {
     if (type == markerType.center)
     {
         if (center == null)
         {
             center             = new GMarkerGoogle(p, GMarkerGoogleType.green_pushpin);
             center.ToolTipText = name;
             center.ToolTipMode = mode;
             markersOverlay.Markers.Add(center);
         }
         else
         {
             center.Position    = p;
             center.ToolTipText = name;
         }
         m_map.Position = center.Position;
     }
     else if (type == markerType.destination)
     {
         if (dest == null)
         {
             dest             = new GMarkerGoogle(p, GMarkerGoogleType.blue);
             dest.ToolTipText = name;
             dest.ToolTipMode = mode;
             markersOverlay.Markers.Add(dest);
         }
         else
         {
             dest.Position    = p;
             dest.ToolTipText = name;
         }
     }
     else
     {
         if (source == null)
         {
             source             = new GMarkerGoogle(p, GMarkerGoogleType.yellow);
             source.ToolTipText = name;
             source.ToolTipMode = mode;
             markersOverlay.Markers.Add(source);
         }
         else
         {
             source.Position    = p;
             source.ToolTipText = name;
         }
     }
 }
예제 #9
0
        /// <summary>
        /// New drawing object for the argument map
        /// </summary>
        /// <param name="offsetX">Offset from the left</param>
        /// <param name="offsetY">Offset from the top</param>
        /// <param name="zoom">Magnification</param>
        public DrawTree(float offsetX, float offsetY, float zoom)
        {
            // Create font and brush.
            drawFont      = new Font("Arial", 16);
            drawFontSmall = new Font("Arial", 8);
            drawBrush     = new SolidBrush(Color.Black);

            justification       = justificationType.jCentre;
            join                = joinType.dogleg;
            arrows              = arrowType.none;
            marker              = markerType.none;
            helpersAsCoPremises = false;

            this.offsetX = offsetX; this.offsetY = offsetY;
            this.zoom    = zoom;
            System.Diagnostics.Debug.Assert(zoom > 0F, "Zoom cannot be zero or less");
        }
예제 #10
0
        public void addAddress(GMapMarker marker, markerType type)
        {
            address tmp = new address();

            tmp.pos  = marker.Position;
            tmp.name = marker.ToolTipText;
            if (type == markerType.source)
            {
                sendAddr.Add(tmp);
                send_comBox.Items.Add(tmp.name);
                send_comBox.SelectedIndex = send_comBox.Items.Count - 1;
            }
            else
            {
                recvAddr.Add(tmp);
                recv_comBox.Items.Add(tmp.name);
                recv_comBox.SelectedIndex = recv_comBox.Items.Count - 1;
            }
            m_sql.insertAddress(tmp, type);
        }
예제 #11
0
        private void deleteAddress(string name, markerType type)
        {
            List <address> li = null;

            if (type == markerType.source)
            {
                li = sendAddr;
            }
            else
            {
                li = recvAddr;
            }
            foreach (var item in li)
            {
                if (item.name == name)
                {
                    m_sql.deleteAddress(item, type);
                    li.Remove(item);
                    break;
                }
            }
        }
예제 #12
0
 public bool checkAddress(string name, markerType type)
 {
     if (type == markerType.destination)
     {
         foreach (var item in recvAddr)
         {
             if (item.name == name)
             {
                 return(false);
             }
         }
     }
     else
     {
         foreach (var item in sendAddr)
         {
             if (item.name == name)
             {
                 return(false);
             }
         }
     }
     return(true);
 }
예제 #13
0
        public void addMarker(PointLatLng p, string name, markerType type)
        {
            GMarkerGoogleType marktype = GMarkerGoogleType.green;

            switch (type)
            {
            case markerType.center:
            {
                if (center == null)
                {
                    center             = new GMarkerGoogle(p, GMarkerGoogleType.green_pushpin);
                    center.ToolTipText = name;
                    center.ToolTipMode = MarkerTooltipMode.OnMouseOver;
                    center.Tag         = "0";
                    markersOverlay.Markers.Add(center);
                }
                else
                {
                    center.Position    = p;
                    center.ToolTipText = name;
                }
                return;
            }

            case markerType.source:
            {
                marktype = GMarkerGoogleType.blue;
                break;
            }

            case markerType.destination:
            {
                marktype = GMarkerGoogleType.green;
                break;
            }

            default:
                marktype = GMarkerGoogleType.green;
                break;
            }
            GMapMarker marker = new GMarkerGoogle(p, marktype);

            if (marktype == GMarkerGoogleType.green)
            {
                marker.Tag = "2";
            }
            else
            {
                marker.Tag = "1";
            }
            marker.ToolTipText = name;
            marker.ToolTipMode = mode;
            markersOverlay.Markers.Add(marker);
            if (addFlag)
            {
                addPoint = marker;
            }
            else
            {
                removePoint = marker;
            }
        }