コード例 #1
0
        /// <summary>
        /// Highlight a geographic object.
        /// </summary>
        /// @param record_number Array index of the record to be highlighted.
        /// @param c The color to use to highlight the record.
        private void Highlight(int record_number, Color c)
        {
            RenderThread drawThread;
            Pen tempPen = (Pen) _pen.Clone();
            tempPen.Color = c;

            if ( _ShapeType == ShapeType.Line )
            {
                tempPen.Width += 2;
                tempPen.StartCap = LineCap.RoundAnchor;
                tempPen.EndCap = LineCap.RoundAnchor;
            }

            HatchBrush tempBrush = new HatchBrush( HatchStyle.Percent70, c, Color.Transparent );

            drawThread = new RenderThread( _mapMetrics, _features,
                _ShapeType, record_number, record_number + 1, tempPen, tempBrush );

            drawThread.Start();

            tempPen.Dispose();
            tempBrush.Dispose();
        }
コード例 #2
0
        /// <summary>
        /// Calculates how many features each RenderThread will draw. Then each
        /// rendering thread is started and we wait for all of the threads to finish 
        /// before continuing on.
        /// </summary>
        public void Draw()
        {
            GenerateDrawList();

            for ( int a=0; a<NUM_THREADS; ++a )
            {
                if ( a == NUM_THREADS - 1 )
                {
                    drawThreads[ a ] = new RenderThread( _mapMetrics, _features,
                        _ShapeType, a * threadBoundary, _features.Length, _pen, _brush );
                }
                else
                {
                    drawThreads[ a ] = new RenderThread( _mapMetrics, _features,
                        _ShapeType, a * threadBoundary, (a + 1) * threadBoundary, _pen, _brush );
                }

                threads[ a ] = new Thread( new ThreadStart( drawThreads[a].Start ) );
                threads[ a ].Start();
            }

            for ( int b=0; b<NUM_THREADS; ++b )
            {
                threads[b].Join();
            }

            // if a feature has been highlighted with a query

            if ( _highlightedFeature != -1 )
            {
                this.Highlight( _highlightedFeature, SystemColors.Highlight );
            }
        }