这篇教程C++ userToDeviceCoordinates函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中userToDeviceCoordinates函数的典型用法代码示例。如果您正苦于以下问题:C++ userToDeviceCoordinates函数的具体用法?C++ userToDeviceCoordinates怎么用?C++ userToDeviceCoordinates使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了userToDeviceCoordinates函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: setFillModevoid SVG_PLOTTER::PlotPoly( const std::vector<wxPoint>& aCornerList, FILL_T aFill, int aWidth ){ if( aCornerList.size() <= 1 ) return; setFillMode( aFill ); SetCurrentLineWidth( aWidth ); switch( aFill ) { case NO_FILL: fprintf( outputFile, "<polyline fill=/"none;/"/n" ); break; case FILLED_WITH_BG_BODYCOLOR: case FILLED_SHAPE: fprintf( outputFile, "<polyline style=/"fill-rule:evenodd;/"/n" ); break; } DPOINT pos = userToDeviceCoordinates( aCornerList[0] ); fprintf( outputFile, "points=/"%d,%d/n", (int) pos.x, (int) pos.y ); for( unsigned ii = 1; ii < aCornerList.size(); ii++ ) { pos = userToDeviceCoordinates( aCornerList[ii] ); fprintf( outputFile, "%d,%d/n", (int) pos.x, (int) pos.y ); } // Close/(fill) the path fprintf( outputFile, "/" /> /n" );}
开发者ID:LDavis4559,项目名称:kicad-source-mirror,代码行数:33,
示例2: SetCurrentLineWidthvoid GERBER_PLOTTER::Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle, int aRadius, FILL_T aFill, int aWidth ){ SetCurrentLineWidth( aWidth ); wxPoint start, end; start.x = aCenter.x + KiROUND( cosdecideg( aRadius, aStAngle ) ); start.y = aCenter.y - KiROUND( sindecideg( aRadius, aStAngle ) ); MoveTo( start ); end.x = aCenter.x + KiROUND( cosdecideg( aRadius, aEndAngle ) ); end.y = aCenter.y - KiROUND( sindecideg( aRadius, aEndAngle ) ); DPOINT devEnd = userToDeviceCoordinates( end ); DPOINT devCenter = userToDeviceCoordinates( aCenter ) - userToDeviceCoordinates( start ); fprintf( outputFile, "G75*/n" ); // Multiquadrant mode if( aStAngle < aEndAngle ) fprintf( outputFile, "G03" ); else fprintf( outputFile, "G02" ); fprintf( outputFile, "X%dY%dI%dJ%dD01*/n", KiROUND( devEnd.x ), KiROUND( devEnd.y ), KiROUND( devCenter.x ), KiROUND( devCenter.y ) ); fprintf( outputFile, "G01*/n" ); // Back to linear interp.}
开发者ID:zhihuitech,项目名称:kicad-source-mirror,代码行数:26,
示例3: wxASSERT/* Plot an arc: * Center = center coord * Stangl, endAngle = angle of beginning and end * Radius = radius of the arc * Command * PU PY x, y; PD start_arc_X AA, start_arc_Y, angle, NbSegm; PU; * Or PU PY x, y; PD start_arc_X AA, start_arc_Y, angle, PU; */void HPGL_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius, FILL_T fill, int width ){ wxASSERT( outputFile ); double angle; if( radius <= 0 ) return; DPOINT centre_dev = userToDeviceCoordinates( centre ); if( m_plotMirror ) angle = StAngle - EndAngle; else angle = EndAngle - StAngle; NORMALIZE_ANGLE_180( angle ); angle /= 10; // Calculate arc start point: wxPoint cmap; cmap.x = centre.x + KiROUND( cosdecideg( radius, StAngle ) ); cmap.y = centre.y - KiROUND( sindecideg( radius, StAngle ) ); DPOINT cmap_dev = userToDeviceCoordinates( cmap ); fprintf( outputFile, "PU;PA %.0f,%.0f;PD;AA %.0f,%.0f,", cmap_dev.x, cmap_dev.y, centre_dev.x, centre_dev.y ); fprintf( outputFile, "%.0f", angle ); fprintf( outputFile, ";PU;/n" ); PenFinish();}
开发者ID:CastMi,项目名称:kicad-source-mirror,代码行数:41,
示例4: userToDeviceCoordinatesvoid PS_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width ){ DPOINT p1_dev = userToDeviceCoordinates( p1 ); DPOINT p2_dev = userToDeviceCoordinates( p2 ); SetCurrentLineWidth( width ); fprintf( outputFile, "%g %g %g %g rect%d/n", p1_dev.x, p1_dev.y, p2_dev.x - p1_dev.x, p2_dev.y - p1_dev.y, fill );}
开发者ID:jerkey,项目名称:kicad,代码行数:9,
示例5: wxASSERT/** * Rectangles in PDF. Supported by the native operator */void PDF_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width ){ wxASSERT( workFile ); DPOINT p1_dev = userToDeviceCoordinates( p1 ); DPOINT p2_dev = userToDeviceCoordinates( p2 ); SetCurrentLineWidth( width ); fprintf( workFile, "%g %g %g %g re %c/n", p1_dev.x, p1_dev.y, p2_dev.x - p1_dev.x, p2_dev.y - p1_dev.y, fill == NO_FILL ? 'S' : 'B' );}
开发者ID:natsfr,项目名称:kicad,代码行数:14,
示例6: wxASSERTvoid PS_PLOTTER::PenTo( const wxPoint& pos, char plume ){ wxASSERT( outputFile ); if( plume == 'Z' ) { if( penState != 'Z' ) { fputs( "stroke/n", outputFile ); penState = 'Z'; penLastpos.x = -1; penLastpos.y = -1; } return; } if( penState == 'Z' ) { fputs( "newpath/n", outputFile ); } if( penState != plume || pos != penLastpos ) { DPOINT pos_dev = userToDeviceCoordinates( pos ); fprintf( outputFile, "%g %g %sto/n", pos_dev.x, pos_dev.y, ( plume=='D' ) ? "line" : "move" ); } penState = plume; penLastpos = pos;}
开发者ID:jerkey,项目名称:kicad,代码行数:29,
示例7: wxASSERT/** * DXF circle: full functionality; it even does 'fills' drawing a * circle with a dual-arc polyline wide as the radius. * * I could use this trick to do other filled primitives */void DXF_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill, int width ){ wxASSERT( outputFile ); double radius = userToDeviceSize( diameter / 2 ); DPOINT centre_dev = userToDeviceCoordinates( centre ); if( radius > 0 ) { wxString cname( ColorGetName( m_currentColor ) ); if (!fill) { fprintf( outputFile, "0/nCIRCLE/n8/n%s/n10/n%g/n20/n%g/n40/n%g/n", TO_UTF8( cname ), centre_dev.x, centre_dev.y, radius ); } if (fill == FILLED_SHAPE) { double r = radius*0.5; fprintf( outputFile, "0/nPOLYLINE/n"); fprintf( outputFile, "8/n%s/n66/n1/n70/n1/n", TO_UTF8( cname )); fprintf( outputFile, "40/n%g/n41/n%g/n", radius, radius); fprintf( outputFile, "0/nVERTEX/n8/n%s/n", TO_UTF8( cname )); fprintf( outputFile, "10/n%g/n 20/n%g/n42/n1.0/n", centre_dev.x-r, centre_dev.y ); fprintf( outputFile, "0/nVERTEX/n8/n%s/n", TO_UTF8( cname )); fprintf( outputFile, "10/n%g/n 20/n%g/n42/n1.0/n", centre_dev.x+r, centre_dev.y ); fprintf( outputFile, "0/nSEQEND/n"); } }}
开发者ID:JOE-JOE-NGIGI,项目名称:kicad,代码行数:36,
示例8: wxASSERT/* Plot round pad or via. */void HPGL_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, EDA_DRAW_MODE_T trace_mode ){ wxASSERT( outputFile ); DPOINT pos_dev = userToDeviceCoordinates( pos ); int delta = KiROUND( penDiameter - penOverlap ); int radius = ( diametre - KiROUND( penDiameter ) ) / 2; if( radius < 0 ) radius = 0; double rsize = userToDeviceSize( radius ); fprintf( outputFile, "PA %.0f,%.0f;CI %.0f;/n", pos_dev.x, pos_dev.y, rsize ); if( trace_mode == FILLED ) // Plot in filled mode. { if( delta > 0 ) { while( (radius -= delta ) >= 0 ) { rsize = userToDeviceSize( radius ); fprintf( outputFile, "PA %.0f,%.0f;CI %.0f;/n", pos_dev.x, pos_dev.y, rsize ); } } } PenFinish();}
开发者ID:corecode,项目名称:kicad-source-mirror,代码行数:34,
示例9: sizevoid GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, EDA_DRAW_MODE_T trace_mode, void* aData ){ wxSize size( diametre, diametre ); GBR_METADATA* gbr_metadata = static_cast<GBR_METADATA*>( aData ); if( trace_mode == SKETCH ) { SetCurrentLineWidth( USE_DEFAULT_LINE_WIDTH, gbr_metadata ); if( gbr_metadata ) formatNetAttribute( &gbr_metadata->m_NetlistMetadata ); Circle( pos, diametre - currentPenWidth, NO_FILL, DO_NOT_SET_LINE_WIDTH ); } else { DPOINT pos_dev = userToDeviceCoordinates( pos ); int aperture_attrib = gbr_metadata ? gbr_metadata->GetApertureAttrib() : 0; selectAperture( size, APERTURE::Circle, aperture_attrib ); if( gbr_metadata ) formatNetAttribute( &gbr_metadata->m_NetlistMetadata ); emitDcode( pos_dev, 3 ); }}
开发者ID:zhihuitech,项目名称:kicad-source-mirror,代码行数:27,
示例10: wxASSERTvoid GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize, double orient, EDA_DRAW_MODE_T trace_mode ){ wxASSERT( outputFile ); wxSize size( aSize ); // Plot as an aperture flash switch( int( orient ) ) { case 900: case 2700: // rotation of 90 degrees or 270 swaps sizes EXCHG( size.x, size.y ); // Pass through case 0: case 1800: if( trace_mode == SKETCH ) { SetCurrentLineWidth( -1 ); Rect( wxPoint( pos.x - (size.x - currentPenWidth) / 2, pos.y - (size.y - currentPenWidth) / 2 ), wxPoint( pos.x + (size.x - currentPenWidth) / 2, pos.y + (size.y - currentPenWidth) / 2 ), NO_FILL ); } else { DPOINT pos_dev = userToDeviceCoordinates( pos ); selectAperture( size, APERTURE::Rect ); emitDcode( pos_dev, 3 ); } break; default: // plot pad shape as polygon { // XXX to do: use an aperture macro to declare the rotated pad wxPoint coord[4]; // coord[0] is assumed the lower left // coord[1] is assumed the upper left // coord[2] is assumed the upper right // coord[3] is assumed the lower right /* Trace the outline. */ coord[0].x = -size.x/2; // lower left coord[0].y = size.y/2; coord[1].x = -size.x/2; // upper left coord[1].y = -size.y/2; coord[2].x = size.x/2; // upper right coord[2].y = -size.y/2; coord[3].x = size.x/2; // lower right coord[3].y = size.y/2; FlashPadTrapez( pos, coord, orient, trace_mode ); } break; }}
开发者ID:natsfr,项目名称:kicad,代码行数:58,
示例11: SetCurrentLineWidthvoid PS_PLOTTER::PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth ){ if( aCornerList.size() <= 1 ) return; SetCurrentLineWidth( aWidth ); DPOINT pos = userToDeviceCoordinates( aCornerList[0] ); fprintf( outputFile, "newpath/n%g %g moveto/n", pos.x, pos.y ); for( unsigned ii = 1; ii < aCornerList.size(); ii++ ) { pos = userToDeviceCoordinates( aCornerList[ii] ); fprintf( outputFile, "%g %g lineto/n", pos.x, pos.y ); } // Close/(fill) the path fprintf( outputFile, "poly%d/n", aFill );}
开发者ID:jerkey,项目名称:kicad,代码行数:20,
示例12: userToDeviceCoordinatesvoid SVG_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T fill, int width ){ DPOINT pos_dev = userToDeviceCoordinates( pos ); double radius = userToDeviceSize( diametre / 2.0 ); setFillMode( fill ); SetCurrentLineWidth( width ); fprintf( outputFile, "<circle cx=/"%g/" cy=/"%g/" r=/"%g/" /> /n", pos_dev.x, pos_dev.y, radius );}
开发者ID:LDavis4559,项目名称:kicad-source-mirror,代码行数:12,
示例13: fputsvoid SVG_PLOTTER::PenTo( const wxPoint& pos, char plume ){ if( plume == 'Z' ) { if( penState != 'Z' ) { fputs( "/" />/n", outputFile ); penState = 'Z'; penLastpos.x = -1; penLastpos.y = -1; } return; } if( penState == 'Z' ) // here plume = 'D' or 'U' { DPOINT pos_dev = userToDeviceCoordinates( pos ); // Ensure we do not use a fill mode when moving tne pen, // in SVG mode (i;e. we are plotting only basic lines, not a filled area if( m_fillMode != NO_FILL ) { setFillMode( NO_FILL ); setSVGPlotStyle(); } fprintf( outputFile, "<path d=/"M%d %d/n", (int) pos_dev.x, (int) pos_dev.y ); } else if( penState != plume || pos != penLastpos ) { DPOINT pos_dev = userToDeviceCoordinates( pos ); fprintf( outputFile, "L%d %d/n", (int) pos_dev.x, (int) pos_dev.y ); } penState = plume; penLastpos = pos;}
开发者ID:LDavis4559,项目名称:kicad-source-mirror,代码行数:40,
示例14: rectvoid SVG_PLOTTER::Rect( const wxPoint& p1, const wxPoint& p2, FILL_T fill, int width ){ EDA_RECT rect( p1, wxSize( p2.x -p1.x, p2.y -p1.y ) ); rect.Normalize(); DPOINT org_dev = userToDeviceCoordinates( rect.GetOrigin() ); DPOINT end_dev = userToDeviceCoordinates( rect.GetEnd() ); DSIZE size_dev = end_dev - org_dev; // Ensure size of rect in device coordinates is > 0 // Inkscape has problems with negative values for width and/or height DBOX rect_dev( org_dev, size_dev); rect_dev.Normalize(); setFillMode( fill ); SetCurrentLineWidth( width ); fprintf( outputFile, "<rect x=/"%g/" y=/"%g/" width=/"%g/" height=/"%g/" rx=/"%g/" />/n", rect_dev.GetPosition().x, rect_dev.GetPosition().y, rect_dev.GetSize().x, rect_dev.GetSize().y, 0.0 // radius of rounded corners );}
开发者ID:LDavis4559,项目名称:kicad-source-mirror,代码行数:22,
示例15: wxASSERTvoid DXF_PLOTTER::PenTo( const wxPoint& pos, char plume ){ wxASSERT( outputFile ); if( plume == 'Z' ) { return; } DPOINT pos_dev = userToDeviceCoordinates( pos ); DPOINT pen_lastpos_dev = userToDeviceCoordinates( penLastpos ); if( penLastpos != pos && plume == 'D' ) { wxASSERT( m_currentLineType >= 0 && m_currentLineType < 4 ); // DXF LINE wxString cname = getDXFColorName( m_currentColor ); const char *lname = getDXFLineType( (PlotDashType) m_currentLineType ); fprintf( outputFile, "0/nLINE/n8/n%s/n6/n%s/n10/n%g/n20/n%g/n11/n%g/n21/n%g/n", TO_UTF8( cname ), lname, pen_lastpos_dev.x, pen_lastpos_dev.y, pos_dev.x, pos_dev.y ); } penLastpos = pos;}
开发者ID:Lotharyx,项目名称:kicad-source-mirror,代码行数:22,
示例16: wxASSERTvoid GERBER_PLOTTER::PenTo( const wxPoint& aPos, char plume ){ wxASSERT( outputFile ); DPOINT pos_dev = userToDeviceCoordinates( aPos ); switch( plume ) { case 'Z': break; case 'U': emitDcode( pos_dev, 2 ); break; case 'D': emitDcode( pos_dev, 1 ); } penState = plume;}
开发者ID:zhihuitech,项目名称:kicad-source-mirror,代码行数:20,
注:本文中的userToDeviceCoordinates函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ user_disable_single_step函数代码示例 C++ userName函数代码示例 |