当前位置: 首页>>代码示例>>C++>>正文


C++ wxDC::DrawPoint方法代码示例

本文整理汇总了C++中wxDC::DrawPoint方法的典型用法代码示例。如果您正苦于以下问题:C++ wxDC::DrawPoint方法的具体用法?C++ wxDC::DrawPoint怎么用?C++ wxDC::DrawPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wxDC的用法示例。


在下文中一共展示了wxDC::DrawPoint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DrawGrooves

void cbBarHintsPlugin::DrawGrooves( wxDC& dc, const wxPoint& pos, int length )
{
    int ofs = 0;

    int i;
    for ( i = 0; i != mGrooveCount; ++i, ofs += ( GROOVE_WIDTH + GROOVE_TO_GROOVE_GAP ) )
    {
        if ( mpPane->IsHorizontal() )
        {
            dc.SetPen( mpLayout->mLightPen );
            dc.DrawLine( pos.x + ofs, pos.y, pos.x + ofs, pos.y + length - 1 );
            dc.DrawPoint( pos.x + ofs + 1, pos.y );

            dc.SetPen( mpLayout->mDarkPen );
            dc.DrawLine( pos.x + ofs + 2, pos.y, pos.x + ofs + 2, pos.y + length );
            dc.DrawPoint( pos.x + ofs + 1, pos.y + length - 1 );
            dc.DrawPoint( pos.x + ofs,     pos.y + length - 1 );
        }
        else
        {
            dc.SetPen( mpLayout->mLightPen );
            dc.DrawLine( pos.x, pos.y + ofs, pos.x + length - 1, pos.y + ofs );
            dc.DrawPoint( pos.x, pos.y + ofs + 1 );

            dc.SetPen( mpLayout->mDarkPen );
            dc.DrawLine( pos.x, pos.y + ofs + 2, pos.x + length, pos.y + ofs + 2 );
            dc.DrawPoint( pos.x + length - 1, pos.y + ofs + 1 );
            dc.DrawPoint( pos.x + length - 1, pos.y + ofs );
        }
    }
}
开发者ID:Bluehorn,项目名称:wxPython,代码行数:31,代码来源:barhintspl.cpp

示例2: DrawFocus

//
// Draws a focus rectangle (Taken directly from wxWidgets source)
//
void AColor::DrawFocus(wxDC & dc, wxRect & rect)
{
   // draw the pixels manually: note that to behave in the same manner as
   // DrawRect(), we must exclude the bottom and right borders from the
   // rectangle
   wxCoord x1 = rect.GetLeft(),
         y1 = rect.GetTop(),
         x2 = rect.GetRight(),
         y2 = rect.GetBottom();

   dc.SetPen(wxPen(wxT("MEDIUM GREY"), 0, wxSOLID));

   // this seems to be closer than what Windows does than wxINVERT although
   // I'm still not sure if it's correct
   dc.SetLogicalFunction(wxAND_REVERSE);

   wxCoord z;
   for ( z = x1 + 1; z < x2; z += 2 )
      dc.DrawPoint(z, y1);

   wxCoord shift = z == x2 ? 0 : 1;
   for ( z = y1 + shift; z < y2; z += 2 )
      dc.DrawPoint(x2, z);

   shift = z == y2 ? 0 : 1;
   for ( z = x2 - shift; z > x1; z -= 2 )
      dc.DrawPoint(z, y2);

   shift = z == x1 ? 0 : 1;
   for ( z = y2 - shift; z > y1; z -= 2 )
      dc.DrawPoint(x1, z);

   dc.SetLogicalFunction(wxCOPY);
}
开发者ID:Avi2011class,项目名称:audacity,代码行数:37,代码来源:AColor.cpp

示例3:

void cbRowDragPlugin::Draw3DPattern( wxRect& inRect, wxDC& dc )
{
    for( int y = inRect.y; y < inRect.y + inRect.height; y+=3 )
    
        for( int x = inRect.x; x < inRect.x + inRect.width; x+=3 )
        {
            dc.SetPen( mpLayout->mLightPen );
            dc.DrawPoint( x,y );
            dc.SetPen( mpLayout->mBlackPen );
            dc.DrawPoint( x+1, y+1 );
        }
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:12,代码来源:rowdragpl.cpp

示例4: gray_out_image_on_dc

void gray_out_image_on_dc( wxDC& dc, int width, int height )
{
    // assuming the pixels along the edges are of the background color
    wxColour bgCol;
    dc.GetPixel( 0, 0, &bgCol );

    wxPen darkPen ( wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW),1, wxSOLID );
    wxPen lightPen( wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT),1, wxSOLID );
    wxPen bgPen   ( bgCol,                1, wxSOLID );

    int* src  = create_array( width, height, MASK_BG );
    int* dest = create_array( width, height, MASK_BG );

    int x, y;
    for ( y = 0; y != height; ++y )
    {
        for ( x = 0; x != width; ++x )
        {
            wxColour col;
            dc.GetPixel( x,y, &col );

            GET_ELEM(src,x,y) = MAKE_INT_COLOR( col.Red(), col.Green(), col.Blue() );
        }
    }
    gray_out_pixmap( src, dest, width, height );

    for ( y = 0; y != height; ++y )
    {
        for ( x = 0; x != width; ++x )
        {
            int mask = GET_ELEM(dest,x,y);

            switch (mask)
            {
                case MASK_BG    : { dc.SetPen( bgPen );
                                    dc.DrawPoint( x,y ); break;
                                  }
                case MASK_DARK  : { dc.SetPen( darkPen );
                                    dc.DrawPoint( x,y ); break;
                                  }
                case MASK_LIGHT : { dc.SetPen( lightPen );
                                    dc.DrawPoint( x,y ); break;
                                  }
                default : break;
            }
        }
    }
    delete [] src;
    delete [] dest;
}
开发者ID:Bluehorn,项目名称:wxPython,代码行数:50,代码来源:newbmpbtn.cpp

示例5: DrawGripper

void wxAuiDefaultDockArt::DrawGripper(wxDC& dc, wxWindow *WXUNUSED(window),
                                      const wxRect& rect,
                                      wxAuiPaneInfo& pane)
{
    dc.SetPen(*wxTRANSPARENT_PEN);
    dc.SetBrush(m_gripperBrush);

    dc.DrawRectangle(rect.x, rect.y, rect.width,rect.height);

    if (!pane.HasGripperTop())
    {
        int y = 5;
        while (1)
        {
            dc.SetPen(m_gripperPen1);
            dc.DrawPoint(rect.x+3, rect.y+y);
            dc.SetPen(m_gripperPen2);
            dc.DrawPoint(rect.x+3, rect.y+y+1);
            dc.DrawPoint(rect.x+4, rect.y+y);
            dc.SetPen(m_gripperPen3);
            dc.DrawPoint(rect.x+5, rect.y+y+1);
            dc.DrawPoint(rect.x+5, rect.y+y+2);
            dc.DrawPoint(rect.x+4, rect.y+y+2);

            y += 4;
            if (y > rect.GetHeight()-5)
                break;
        }
    }
    else
    {
        int x = 5;
        while (1)
        {
            dc.SetPen(m_gripperPen1);
            dc.DrawPoint(rect.x+x, rect.y+3);
            dc.SetPen(m_gripperPen2);
            dc.DrawPoint(rect.x+x+1, rect.y+3);
            dc.DrawPoint(rect.x+x, rect.y+4);
            dc.SetPen(m_gripperPen3);
            dc.DrawPoint(rect.x+x+1, rect.y+5);
            dc.DrawPoint(rect.x+x+2, rect.y+5);
            dc.DrawPoint(rect.x+x+2, rect.y+4);

            x += 4;
            if (x > rect.GetWidth()-5)
                break;
        }
    }
}
开发者ID:CodeTickler,项目名称:wxWidgets,代码行数:50,代码来源:dockart.cpp

示例6: Line

//
// Draw a line while accounting for differences in wxWidgets versions
//
void AColor::Line(wxDC & dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
{
   // As of 2.8.9 (possibly earlier), wxDC::DrawLine() on the Mac draws the
   // last point since it is now based on the NEW wxGraphicsContext system.
   // Make the other platforms do the same thing since the other platforms
   // "may" follow they get wxGraphicsContext going.
#if defined(__WXMAC__) || defined(__WXGTK3__)
   dc.DrawLine(x1, y1, x2, y2);
#else
   bool point = false;

   if (x1 == x2) {
      if (y1 < y2) {
         y2++;
      }
      else if (y2 < y1) {
         y1++;
      }
      else {
         point = true;
      }
   }
   else if (y1 == y2) {
      if (x1 < x2) {
         x2++;
      }
      else if (x2 < x1) {
         x1++;
      }
      else {
         point = true;
      }
   }
   else {
      dc.DrawPoint(x2, y2);
   }

   if (point) {
      dc.DrawPoint(x2, y2);
   }
   else {
      dc.DrawLine(x1, y1, x2, y2);
   }
#endif
}
开发者ID:Avi2011class,项目名称:audacity,代码行数:48,代码来源:AColor.cpp

示例7: drawDottedLine

void SeqPlot::drawDottedLine ( wxDC &dc , int x1 , int y1 , int x2 , int y2 )
    {
    if ( can->isPrinting() )
        {
        dc.DrawLine ( x1 , y1 , x2 , y2 ) ;
        return ;
        }
    int i ;
    if ( x1 == x2 )
        {
        for ( i = y1 ; i <= y2 ; i++ )
           if ( i & 1 ) dc.DrawPoint ( x1 , i ) ;
        }
    else
        {
        for ( i = x1 ; i <= x2 ; i++ )
           if ( i & 1 ) dc.DrawPoint ( i , y1 ) ;
        }
    }
开发者ID:magnusmanske,项目名称:gentle-m,代码行数:19,代码来源:SequenceTypePlot.cpp

示例8: WXUNUSED

void
wxStdRenderer::DrawFocusRect(wxWindow* WXUNUSED(win), wxDC& dc, const wxRect& rect, int WXUNUSED(flags))
{
    // draw the pixels manually because the "dots" in wxPen with wxDOT style
    // may be short traits and not really dots
    //
    // note that to behave in the same manner as DrawRect(), we must exclude
    // the bottom and right borders from the rectangle
    wxCoord x1 = rect.GetLeft(),
            y1 = rect.GetTop(),
            x2 = rect.GetRight(),
            y2 = rect.GetBottom();

    dc.SetPen(m_penBlack);

    // this seems to be closer than what Windows does than wxINVERT although
    // I'm still not sure if it's correct
    dc.SetLogicalFunction(wxAND_REVERSE);

    wxCoord z;
    for ( z = x1 + 1; z < x2; z += 2 )
        dc.DrawPoint(z, rect.GetTop());

    wxCoord shift = z == x2 ? 0 : 1;
    for ( z = y1 + shift; z < y2; z += 2 )
        dc.DrawPoint(x2, z);

    shift = z == y2 ? 0 : 1;
    for ( z = x2 - shift; z > x1; z -= 2 )
        dc.DrawPoint(z, y2);

    shift = z == x1 ? 0 : 1;
    for ( z = y2 - shift; z > y1; z -= 2 )
        dc.DrawPoint(x1, z);

    dc.SetLogicalFunction(wxCOPY);
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:37,代码来源:stdrend.cpp

示例9: myRect

void SeqPlot::myRect ( wxDC &dc , int x , int y , int w , int h )
    {
    if ( can->isPrinting() )
        {
        for ( int i = 0 ; i <= h ; i++ )
           dc.DrawLine ( x , y+i , x+w , y+i ) ;
        return ;
        }
    for ( int i = 0 ; i < w ; i++ )
        {
        for ( int j = 0 ; j < h ; j++ )
           {
           if ( ( x+i + y+j ) & 1 ) dc.DrawPoint ( x + i , y + j ) ;
           }
        }
    }
开发者ID:magnusmanske,项目名称:gentle-m,代码行数:16,代码来源:SequenceTypePlot.cpp

示例10: DrawCell

void LifeCanvas::DrawCell(wxInt32 i, wxInt32 j, wxDC &dc)
{
    wxCoord x = CellToX(i);
    wxCoord y = CellToY(j);

    // if cellsize is 1 or 2, there will be no grid
    switch (m_cellsize)
    {
        case 1:
            dc.DrawPoint(x, y);
            break;
        case 2:
            dc.DrawRectangle(x, y, 2, 2);
            break;
        default:
            dc.DrawRectangle(x + 1, y + 1, m_cellsize - 1, m_cellsize - 1);
    }
}
开发者ID:crankycoder,项目名称:wxPython-2.9.2.4,代码行数:18,代码来源:life.cpp

示例11: OnDraw


//.........这里部分代码省略.........
        pnts[n].x = tabRight - 1;    pnts[n++].y = tabTop;
        dc.DrawLines(n, pnts);
        if (!lastInRow)
        {
            dc.DrawLine(
                    (tabRight + 2),
                    top,
                    right,
                    top
                    );
        }

        dc.SetPen(*(m_view->GetShadowPen()));
        dc.DrawLine(
                tabRight,
                tabTop + 2,
                tabRight,
                top
                );
        dc.DrawLine(
                right,
                top,
                right,
                bottom
                );
        dc.DrawLine(
                right,
                bottom,
                left,
                bottom
                );

        dc.SetPen(*wxBLACK_PEN);
        dc.DrawPoint(
                tabRight,
                tabTop + 1
                );
        dc.DrawPoint(
                tabRight + 1,
                tabTop + 2
                );
        if (lastInRow)
        {
            dc.DrawLine(
                tabRight + 1,
                bottom,
                tabRight + 1,
                tabTop + 1
                );
        }
        else
        {
            dc.DrawLine(
                tabRight + 1,
                tabTop + 2,
                tabRight + 1,
                top
                );
            dc.DrawLine(
                right + 1,
                top,
                right + 1,
                bottom + 1
                );
        }
        dc.DrawLine(
开发者ID:CyberIntelMafia,项目名称:clamav-devel,代码行数:67,代码来源:tabg.cpp

示例12: Draw

bool SjOscStar::Draw(wxDC& dc, const wxSize& clientSize, double rot, wxPen& pen, wxBrush& brush)
{
	double  xfloat, yfloat;
	int     x, y, hh, vv;
	int     d, intensity;

	m_z -= 2;
	if( m_z < -63 )
	{
		m_z = STAR_DEPTH;
		m_doDraw = !m_exitRequest;
	}

	hh = (m_x*64)/(64+m_z);
	vv = (m_y*64)/(64+m_z);

	// check position
	x = hh + 500;
	y = vv + 500;
	if( x < -300 || x > 1300 || y < -300 || y > 1300 )
	{
		m_z = STAR_DEPTH;
		m_doDraw = !m_exitRequest;

		hh = (m_x*64)/(64+m_z);
		vv = (m_y*64)/(64+m_z);
	}

	// calculate position
	xfloat = (hh*cos(rot))-(vv*sin(rot));
	yfloat = (hh*sin(rot))+(vv*cos(rot));

	x = (int)xfloat + 500;
	y = (int)yfloat + 500;

	// use star?
	if( !m_doDraw )
	{
		if( m_exitRequest || x < 450 || x > 550 || y < 450 || y > 550 )
		{
			return FALSE;
		}
		else
		{
			m_doDraw = TRUE;
		}
	}

	// map star position to client size, keep aspect ratio
	d = clientSize.x;
	if( clientSize.y > d )
	{
		d = clientSize.y;
	}

	if( d == 0 )
	{
		d = 10;
	}

	x = (x * d) / 1000 - (d-clientSize.x)/2;
	y = (y * d) / 1000 - (d-clientSize.y)/2;

	// calculate size
	d = (STAR_DEPTH-m_z) / (38400/d);
	if( d == 0 ) d = 1;

	// calculate light intensity
	intensity = STAR_DEPTH-m_z;
	intensity = 55 + ((intensity * 200) / STAR_DEPTH);
	//if( intensity < light ) intensity = light + 10;
	if( intensity < 0   )   intensity = 0;
	if( intensity > 255 )   intensity = 255;

	// draw star
	if( d==1 )
	{
		pen.SetColour(intensity, intensity, intensity);
		dc.SetPen(pen);
		dc.DrawPoint(x, y);
	}
	else
	{
		dc.SetPen(*wxTRANSPARENT_PEN);

		brush.SetColour(intensity, intensity, intensity);
		dc.SetBrush(brush);

		dc.DrawRectangle(x, y, d, d);
	}

	return TRUE;
}
开发者ID:antonivich,项目名称:Silverjuke,代码行数:93,代码来源:vis_oscilloscope.cpp

示例13: OnDraw

// Define the repainting behaviour
void MyCanvas::OnDraw(wxDC& dc)
{
    // vars to use ...
#if wxUSE_STATUSBAR
    wxString s;
#endif // wxUSE_STATUSBAR
    wxPen wP;
    wxBrush wB;
    wxPoint points[6];
    wxColour wC;
    wxFont wF;

    dc.SetFont(*wxSWISS_FONT);
    dc.SetPen(*wxGREEN_PEN);

    switch (m_index)
    {
        default:
        case 0:
            // draw lines to make a cross
            dc.DrawLine(0, 0, 200, 200);
            dc.DrawLine(200, 0, 0, 200);
            // draw point colored line and spline
            wP = *wxCYAN_PEN;
            wP.SetWidth(3);
            dc.SetPen(wP);

            dc.DrawPoint (25,15);
            dc.DrawLine(50, 30, 200, 30);
            dc.DrawSpline(50, 200, 50, 100, 200, 10);
#if wxUSE_STATUSBAR
            s = wxT("Green Cross, Cyan Line and spline");
#endif // wxUSE_STATUSBAR
            break;

        case 1:
            // draw standard shapes
            dc.SetBrush(*wxCYAN_BRUSH);
            dc.SetPen(*wxRED_PEN);
            dc.DrawRectangle(10, 10, 100, 70);
            wB = wxBrush (wxT("DARK ORCHID"), wxBRUSHSTYLE_TRANSPARENT);
            dc.SetBrush (wB);
            dc.DrawRoundedRectangle(50, 50, 100, 70, 20);
            dc.SetBrush (wxBrush(wxT("GOLDENROD")) );
            dc.DrawEllipse(100, 100, 100, 50);

            points[0].x = 100; points[0].y = 200;
            points[1].x = 70; points[1].y = 260;
            points[2].x = 160; points[2].y = 230;
            points[3].x = 40; points[3].y = 230;
            points[4].x = 130; points[4].y = 260;
            points[5].x = 100; points[5].y = 200;

            dc.DrawPolygon(5, points);
            dc.DrawLines (6, points, 160);
#if wxUSE_STATUSBAR
            s = wxT("Blue rectangle, red edge, clear rounded rectangle, gold ellipse, gold and clear stars");
#endif // wxUSE_STATUSBAR
            break;

        case 2:
            // draw text in Arial or similar font
            dc.DrawLine(50,25,50,35);
            dc.DrawLine(45,30,55,30);
            dc.DrawText(wxT("This is a Swiss-style string"), 50, 30);
            wC = dc.GetTextForeground();
            dc.SetTextForeground (wxT("FIREBRICK"));

            // no effect in msw ??
            dc.SetTextBackground (wxT("WHEAT"));
            dc.DrawText(wxT("This is a Red string"), 50, 200);
            dc.DrawRotatedText(wxT("This is a 45 deg string"), 50, 200, 45);
            dc.DrawRotatedText(wxT("This is a 90 deg string"), 50, 200, 90);
            wF = wxFont ( 18, wxROMAN, wxITALIC, wxBOLD, false, wxT("Times New Roman"));
            dc.SetFont(wF);
            dc.SetTextForeground (wC);
            dc.DrawText(wxT("This is a Times-style string"), 50, 60);
#if wxUSE_STATUSBAR
            s = wxT("Swiss, Times text; red text, rotated and colored orange");
#endif // wxUSE_STATUSBAR
            break;

        case 3 :
            // four arcs start and end points, center
            dc.SetBrush(*wxGREEN_BRUSH);
            dc.DrawArc ( 200,300, 370,230, 300,300 );
            dc.SetBrush(*wxBLUE_BRUSH);
            dc.DrawArc ( 270-50, 270-86, 270-86, 270-50, 270,270 );
            dc.SetDeviceOrigin(-10,-10);
            dc.DrawArc ( 270-50, 270-86, 270-86, 270-50, 270,270 );
            dc.SetDeviceOrigin(0,0);

            wP.SetColour (wxT("CADET BLUE"));
            dc.SetPen(wP);
            dc.DrawArc ( 75,125, 110, 40, 75, 75 );

            wP.SetColour (wxT("SALMON"));
            dc.SetPen(wP);
            dc.SetBrush(*wxRED_BRUSH);
//.........这里部分代码省略.........
开发者ID:ExperimentationBox,项目名称:Edenite,代码行数:101,代码来源:svgtest.cpp

示例14: draw

//void simple_vector_layer::Draw(wxDC &dc, wxCoord x, wxCoord y, bool transparent, double zoomFactor, double translationX, double translationY, double resolution) const
void simple_vector_layer::draw(wxDC &dc, wxCoord x, wxCoord y, bool transparent) const
{
    wxPen pen;
    wxBrush brush;

    // 2D
    pen.SetWidth(m_polygon_border_width);
    pen.SetColour(m_polygon_border_color);
    pen.SetStyle(m_polygon_border_style);
    brush.SetColour(m_polygon_inner_color);
    brush.SetStyle(m_polygon_inner_style);
    dc.SetPen(pen);
    dc.SetBrush(brush);
    for (unsigned int i = 0; i < m_circles.size(); i++)
    {
        wxPoint p = transform().from_local_int(m_circles[i]);
        wxCoord r = static_cast<wxCoord>(m_circles[i].radius / transform().zoom_factor());
        dc.DrawCircle(p, r);
    }
    // Ellipses alignees
    for (unsigned int i=0;i<m_ellipses.size();++i)
    {
        wxPoint p = transform().from_local_int(m_ellipses[i]);
        wxSize  s(
                static_cast<wxCoord>(2*m_ellipses[i].a/transform().zoom_factor()),
                static_cast<wxCoord>(2*m_ellipses[i].b/transform().zoom_factor())
                );
        dc.DrawEllipse(p,s);
        //dc.DrawEllipticArc(p,s,0.,90.);
        //dc.DrawEllipticArcRot(p,s,0.,90.);
    }
    // Ellipses non alignees
    for (unsigned int i=0;i<m_rotatedellipses.size();++i)
    {
        std::vector<wxPoint> points;
        points.reserve( m_rotatedellipses[i].controlPoints.size() );
        for (unsigned int j=0;j<m_rotatedellipses[i].controlPoints.size();++j)
            points.push_back(transform().from_local_int(m_rotatedellipses[i].controlPoints[j]));
        dc.DrawSpline(static_cast<int>(points.size()),&points.front());
    }
    for (unsigned int i=0;i<m_polygons.size();++i)
    {
        std::vector<wxPoint> points;
        points.reserve( m_polygons[i].size() );
        for (unsigned int j=0;j<m_polygons[i].size();++j)
            points.push_back(transform().from_local_int(m_polygons[i][j]));
        dc.DrawPolygon( static_cast<int>(points.size()) , &(points.front()) );
    }

    // 1D
    pen.SetColour(m_line_color);
    pen.SetWidth(m_line_width);
    pen.SetStyle(m_line_style);
    dc.SetPen(pen);
    for (unsigned int i = 0; i < m_arcs.size(); i++)
    {
        const arc_type &local_tab = m_arcs[i];
        for (unsigned int j = 0; j < local_tab.arc_points.size() - 1; ++j)
        {
            wxPoint p = transform().from_local_int(local_tab.arc_points[j  ]);
            wxPoint q = transform().from_local_int(local_tab.arc_points[j+1]);
            dc.DrawLine(p,q);
        }
    }
    // Splines
    for (unsigned int i=0;i<m_splines.size();++i)
    {
        const spline_type& spline = m_splines[i];
        std::vector<wxPoint> points;
        unsigned int n = static_cast<int>(spline.size());
        for (unsigned int j=0;j<n;++j)
        {
            wxPoint p = transform().from_local_int(spline[j]);
            points.push_back(p);
        }
        dc.DrawSpline(n,&points.front());
    }

    // 0D
    pen.SetColour(m_point_color);
    pen.SetWidth(m_point_width);
    dc.SetPen(pen);
    for (unsigned int i = 0; i < m_points.size(); i++)
    {
        wxPoint p = transform().from_local_int(m_points[i]);
        //dc.DrawLine(p);
        dc.DrawPoint(p);
    }

    // Text
    if(text_visibility())
    {
        pen.SetColour(m_text_color);
        dc.SetPen(pen);
        for (unsigned int i = 0; i < m_texts.size(); i++)
        {
            wxPoint p = transform().from_local_int(m_texts[i].first);
            //dc.DrawLine(p);
            dc.DrawText(wxString(m_texts[i].second.c_str(),*wxConvCurrent),p);
//.........这里部分代码省略.........
开发者ID:myirci,项目名称:gilviewer,代码行数:101,代码来源:simple_vector_layer.cpp

示例15: FullRefresh

void GraphPane::FullRefresh(wxDC& dc)
{
    // Erase Background
    wxCoord width, height;
    this->GetSize(&width, &height);

    dc.SetPen((BlackBG ? *wxBLACK_PEN : *wxWHITE_PEN));
    dc.SetBrush(BlackBG ? *wxBLACK_BRUSH : *wxWHITE_BRUSH);
    dc.DrawRectangle(0, 0, width, height);

    // Set the origin at the centre
    dc.SetDeviceOrigin(wxCoord(width/2), wxCoord(height/2));


    wxPen pen((BlackBG ? *wxWHITE : *wxBLACK), 1);
    wxBrush brush((BlackBG ? *wxBLACK_BRUSH : *wxWHITE_BRUSH));
    dc.SetPen(pen);

    if (GraphInfoVector != NULL && !(GraphInfoVector->empty())) {

        // Declare iterators for each set of coordinates --> Loop through all trails/sets of coordinates
        std::vector<GraphInfo*>::const_iterator CoordSetIt;

        // Declare iterators for each trail
        std::deque<double>::const_iterator XCoordIt;
        std::deque<double>::const_iterator YCoordIt;

        //Begin iterating
        CoordSetIt = GraphInfoVector->begin();

        while (CoordSetIt != GraphInfoVector->end()) {
            // Set Colour
            if ((*CoordSetIt)->TrailColour == *wxBLACK && BlackBG) {
                    pen = wxPen(*wxWHITE, 1);
            } else {
                    pen = wxPen((*CoordSetIt)->TrailColour, 1);
            }
            dc.SetPen(pen);

            // Iterate through all coordinates
            if ((*CoordSetIt)->XCoordinate.size() > unsigned(NewPoints)) {
                XCoordIt = (*CoordSetIt)->XCoordinate.begin() + NewPoints - 1;
                YCoordIt = (*CoordSetIt)->YCoordinate.begin() + NewPoints - 1;
            }
            else {
                XCoordIt = (*CoordSetIt)->XCoordinate.begin();
                YCoordIt = (*CoordSetIt)->YCoordinate.begin();
            }


            while (XCoordIt != (*CoordSetIt)->XCoordinate.end()) {
                dc.DrawPoint(wxCoord((*XCoordIt) * ScalingFactor), wxCoord((*YCoordIt) * ScalingFactor* (-1)));
                XCoordIt++;
                YCoordIt++;
            }


            // If terminator size > 0, draw circle terminator at last coordinate.
            if ((*CoordSetIt)->TermSize > 0) {
                XCoordIt--;
                YCoordIt--;

                if ((*CoordSetIt)->TrailColour == *wxBLACK && BlackBG) {
                    brush.SetColour(*wxWHITE);
                } else {
                    brush.SetColour((*CoordSetIt)->TrailColour);
                }
                dc.SetBrush(brush);
                dc.DrawEllipse(wxCoord((*XCoordIt) * ScalingFactor - (*CoordSetIt)->TermSize),
                               wxCoord((*YCoordIt) * ScalingFactor* (-1) - (*CoordSetIt)->TermSize),
                               (*CoordSetIt)->TermSize * 2, (*CoordSetIt)->TermSize * 2);
            }

            ++CoordSetIt;
        }
    }
}
开发者ID:samuelyeewl,项目名称:orb-orbital-simulator,代码行数:77,代码来源:GraphPane.cpp


注:本文中的wxDC::DrawPoint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。