这篇教程C++ EXCHG函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中EXCHG函数的典型用法代码示例。如果您正苦于以下问题:C++ EXCHG函数的具体用法?C++ EXCHG怎么用?C++ EXCHG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了EXCHG函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetDefaultLineThicknessvoid SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset, GR_DRAWMODE DrawMode, EDA_COLOR_T Color ){ EDA_COLOR_T color; int linewidth = ( m_Thickness == 0 ) ? GetDefaultLineThickness() : m_Thickness; linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold ); if( Color >= 0 ) color = Color; else color = ReturnLayerColor( m_Layer ); GRSetDrawMode( DC, DrawMode ); wxPoint text_offset = aOffset + GetSchematicTextOffset(); EXCHG( linewidth, m_Thickness ); // Set the minimum width EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR ); EXCHG( linewidth, m_Thickness ); // set initial value if( m_isDangling ) DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color ); // Enable these line to draw the bounding box (debug tests purposes only)#if 0 { EDA_RECT BoundaryBox = GetBoundingBox(); GRRect( panel->GetClipBox(), DC, BoundaryBox, 0, BROWN ); }#endif}
开发者ID:james-sakalaukus,项目名称:kicad,代码行数:31,
示例2: wxASSERTvoid PS_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius, FILL_T fill, int width ){ wxASSERT( outputFile ); if( radius <= 0 ) return; if( StAngle > EndAngle ) EXCHG( StAngle, EndAngle ); SetCurrentLineWidth( width ); // Calculate start point. DPOINT centre_dev = userToDeviceCoordinates( centre ); double radius_dev = userToDeviceSize( radius ); if( m_plotMirror ) { if( m_mirrorIsHorizontal ) { StAngle = 1800.0 -StAngle; EndAngle = 1800.0 -EndAngle; EXCHG( StAngle, EndAngle ); } else { StAngle = -StAngle; EndAngle = -EndAngle; } } fprintf( outputFile, "%g %g %g %g %g arc%d/n", centre_dev.x, centre_dev.y, radius_dev, StAngle / 10.0, EndAngle / 10.0, fill );}
开发者ID:jerkey,项目名称:kicad,代码行数:34,
示例3: EXCHGvoid PCB_TARGET::Exchg( PCB_TARGET* source ){ EXCHG( m_Pos, source->m_Pos ); EXCHG( m_Width, source->m_Width ); EXCHG( m_Size, source->m_Size ); EXCHG( m_Shape, source->m_Shape );}
开发者ID:james-sakalaukus,项目名称:kicad,代码行数:7,
示例4: wxCHECK_RETvoid SCH_BUS_ENTRY::SwapData( SCH_ITEM* aItem ){ wxCHECK_RET( (aItem != NULL) && (aItem->Type() == SCH_BUS_ENTRY_T), wxT( "Cannot swap bus entry data with invalid item." ) ); SCH_BUS_ENTRY* item = (SCH_BUS_ENTRY*)aItem; EXCHG( m_pos, item->m_pos ); EXCHG( m_size, item->m_size ); EXCHG( m_width, item->m_width );}
开发者ID:james-sakalaukus,项目名称:kicad,代码行数:10,
示例5: wxASSERTvoid GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient, EDA_DRAW_MODE_T trace_mode ){ wxASSERT( outputFile ); int x0, y0, x1, y1, delta; wxSize size( aSize ); /* Plot a flashed shape. */ if( ( orient == 0 || orient == 900 || orient == 1800 || orient == 2700 ) && trace_mode == FILLED ) { if( orient == 900 || orient == 2700 ) /* orientation turned 90 deg. */ EXCHG( size.x, size.y ); DPOINT pos_dev = userToDeviceCoordinates( pos ); selectAperture( size, APERTURE::Oval ); emitDcode( pos_dev, 3 ); } else /* Plot pad as a segment. */ { if( size.x > size.y ) { EXCHG( size.x, size.y ); if( orient < 2700 ) orient += 900; else orient -= 2700; } if( trace_mode == FILLED ) { /* XXX to do: use an aperture macro to declare the rotated pad */ /* The pad is reduced to an oval with dy > dx */ delta = size.y - size.x; x0 = 0; y0 = -delta / 2; x1 = 0; y1 = delta / 2; RotatePoint( &x0, &y0, orient ); RotatePoint( &x1, &y1, orient ); ThickSegment( wxPoint( pos.x + x0, pos.y + y0 ), wxPoint( pos.x + x1, pos.y + y1 ), size.x, trace_mode ); } else { sketchOval( pos, size, orient, -1 ); } }}
开发者ID:natsfr,项目名称:kicad,代码行数:51,
示例6: incrementvoid PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius, FILL_T fill, int width ){ wxPoint start, end; const int delta = 50; // increment (in 0.1 degrees) to draw circles if( StAngle > EndAngle ) EXCHG( StAngle, EndAngle ); SetCurrentLineWidth( width ); /* Please NOTE the different sign due to Y-axis flip */ start.x = centre.x + KiROUND( cosdecideg( radius, -StAngle ) ); start.y = centre.y + KiROUND( sindecideg( radius, -StAngle ) ); MoveTo( start ); for( int ii = StAngle + delta; ii < EndAngle; ii += delta ) { end.x = centre.x + KiROUND( cosdecideg( radius, -ii ) ); end.y = centre.y + KiROUND( sindecideg( radius, -ii ) ); LineTo( end ); } end.x = centre.x + KiROUND( cosdecideg( radius, -EndAngle ) ); end.y = centre.y + KiROUND( sindecideg( radius, -EndAngle ) ); FinishTo( end );}
开发者ID:BTR1,项目名称:kicad-source-mirror,代码行数:25,
示例7: EXCHGwxPoint GERBER_DRAW_ITEM::GetABPosition( const wxPoint& aXYPosition ) const{ /* Note: RS274Xrevd_e is obscure about the order of transforms: * For instance: Rotation must be made after or before mirroring ? * Note: if something is changed here, GetYXPosition must reflect changes */ wxPoint abPos = aXYPosition + m_imageParams->m_ImageJustifyOffset; if( m_swapAxis ) EXCHG( abPos.x, abPos.y ); abPos += m_layerOffset + m_imageParams->m_ImageOffset; abPos.x = KiROUND( abPos.x * m_drawScale.x ); abPos.y = KiROUND( abPos.y * m_drawScale.y ); double rotation = m_lyrRotation * 10 + m_imageParams->m_ImageRotation * 10; if( rotation ) RotatePoint( &abPos, -rotation ); // Negate A axis if mirrored if( m_mirrorA ) NEGATE( abPos.x ); // abPos.y must be negated when no mirror, because draw axis is top to bottom if( !m_mirrorB ) NEGATE( abPos.y ); return abPos;}
开发者ID:Th0rN13,项目名称:kicad-source-mirror,代码行数:28,
示例8: EXCHGvoid DIALOG_EESCHEMA_CONFIG::OnButtonDownClick( wxCommandEvent& event ){ wxArrayInt selections; m_ListLibr->GetSelections(selections); if ( selections.GetCount() <= 0 ) // No selection. return; // The last lib is selected. cannot move down it if( selections.Last() == (int)(m_ListLibr->GetCount()-1) ) return; wxArrayString libnames = m_ListLibr->GetStrings(); for( int ii = selections.GetCount()-1; ii >= 0; ii-- ) { int jj = selections[ii]; EXCHG( libnames[jj], libnames[jj+1]); } m_ListLibr->Set( libnames ); // Reselect previously selected names for( size_t ii = 0; ii < selections.GetCount(); ii++ ) { int jj = selections[ii]; m_ListLibr->SetSelection(jj+1); } m_LibListChanged = true;}
开发者ID:johnbeard,项目名称:kicad-source-mirror,代码行数:32,
示例9: wxASSERT/* Plot oval pad. */void HPGL_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient, EDA_DRAW_MODE_T trace_mode ){ wxASSERT( outputFile ); int deltaxy, cx, cy; wxSize size( aSize ); /* The pad is reduced to an oval with size.y > size.x * (Oval vertical orientation 0) */ if( size.x > size.y ) { EXCHG( size.x, size.y ); orient = AddAngles( orient, 900 ); } deltaxy = size.y - size.x; // distance between centers of the oval if( trace_mode == FILLED ) { FlashPadRect( pos, wxSize( size.x, deltaxy + KiROUND( penDiameter ) ), orient, trace_mode ); cx = 0; cy = deltaxy / 2; RotatePoint( &cx, &cy, orient ); FlashPadCircle( wxPoint( cx + pos.x, cy + pos.y ), size.x, trace_mode ); cx = 0; cy = -deltaxy / 2; RotatePoint( &cx, &cy, orient ); FlashPadCircle( wxPoint( cx + pos.x, cy + pos.y ), size.x, trace_mode ); } else // Plot in SKETCH mode. { sketchOval( pos, size, orient, KiROUND( penDiameter ) ); }}
开发者ID:barrem,项目名称:kicad-source-mirror,代码行数:36,
示例10: NEGATEwxPoint GERBER_DRAW_ITEM::GetXYPosition( const wxPoint& aABPosition ){ // do the inverse transform made by GetABPosition wxPoint xyPos = aABPosition; if( m_mirrorA ) NEGATE( xyPos.x ); if( !m_mirrorB ) NEGATE( xyPos.y ); double rotation = m_lyrRotation * 10 + m_imageParams->m_ImageRotation * 10; if( rotation ) RotatePoint( &xyPos, rotation ); xyPos.x = KiROUND( xyPos.x / m_drawScale.x ); xyPos.y = KiROUND( xyPos.y / m_drawScale.y ); xyPos -= m_layerOffset + m_imageParams->m_ImageOffset; if( m_swapAxis ) EXCHG( xyPos.x, xyPos.y ); return xyPos - m_imageParams->m_ImageJustifyOffset;}
开发者ID:Th0rN13,项目名称:kicad-source-mirror,代码行数:25,
示例11: IsBusLabelint IsBusLabel( const char * LabelDrawList )/**************************************************//* Routine qui verifie si le Label a une notation de type Bus Retourne 0 si non nombre de membres si oui met a jour FirstNumWireBus, LastNumWireBus et RootBusNameLength*/{char * Num;char BufLine[1024]; if ( strchr(LabelDrawList,'[') == NULL ) /* 1er [ trouve : c'est une notation de Bus */ return(0); strcpy(BufLine, LabelDrawList); Num = strtok(BufLine,"["); RootBusNameLength = strlen(Num); Num = strtok(NULL,"."); FirstNumWireBus = atoi(Num); Num = strtok(NULL,".]"); LastNumWireBus = atoi(Num); if( FirstNumWireBus < 0 ) FirstNumWireBus = 0; if( LastNumWireBus < 0 ) LastNumWireBus = 0; if( FirstNumWireBus > LastNumWireBus ) { EXCHG( FirstNumWireBus, LastNumWireBus); } return(LastNumWireBus - FirstNumWireBus + 1 );}
开发者ID:BackupTheBerlios,项目名称:kicad-svn,代码行数:34,
示例12: gr_vlineint gr_vline(int y1, int y2, int x){ int i; if (y1 > y2) EXCHG(y1,y2); for (i=y1; i<=y2; i++ ) gr_upixel( x, i ); return 0;}
开发者ID:paud,项目名称:d2x-xl,代码行数:8,
示例13: gr_vlineint gr_vline(int y1, int y2, int x) { int i; if (y1 > y2) EXCHG(y1, y2); for (i = y1; i <= y2; i++) // gr_upixel( x, i ); DATA[ROWSIZE*i + x] = COLOR; return 0;}
开发者ID:devint1,项目名称:descent-win,代码行数:8,
示例14: gr_hlineint gr_hline(int x1, int x2, int y){ int i; if (x1 > x2) EXCHG(x1,x2); for (i=x1; i<=x2; i++ ) gr_upixel( i, y ); return 0;}
开发者ID:paud,项目名称:d2x-xl,代码行数:9,
示例15: gr_hlineint gr_hline(int x1, int x2, int y) { int i; int t; if (x1 > x2) EXCHG(x1, x2); t = ROWSIZE * y; for (i = x1; i <= x2; i++) { // gr_upixel( i, y ); DATA[t + i] = COLOR; } return 0;}
开发者ID:devint1,项目名称:descent-win,代码行数:12,
示例16: wxCHECK_RETvoid SCH_SHEET::SwapData( SCH_ITEM* aItem ){ wxCHECK_RET( aItem->Type() == SCH_SHEET_T, wxString::Format( wxT( "SCH_SHEET object cannot swap data with %s object." ), GetChars( aItem->GetClass() ) ) ); SCH_SHEET* sheet = ( SCH_SHEET* ) aItem; EXCHG( m_pos, sheet->m_pos ); EXCHG( m_size, sheet->m_size ); EXCHG( m_name, sheet->m_name ); EXCHG( m_sheetNameSize, sheet->m_sheetNameSize ); EXCHG( m_fileNameSize, sheet->m_fileNameSize ); m_pins.swap( sheet->m_pins ); // Ensure sheet labels have their .m_Parent member pointing really on their // parent, after swapping. BOOST_FOREACH( SCH_SHEET_PIN& sheetPin, m_pins ) { sheetPin.SetParent( this ); }
开发者ID:jerkey,项目名称:kicad,代码行数:21,
示例17: OnModify// Rotate selected pad 90 degrees.void PCB_BASE_FRAME::RotatePad( D_PAD* aPad, wxDC* DC ){ if( aPad == NULL ) return; MODULE* module = aPad->GetParent(); module->SetLastEditTime(); OnModify(); if( DC ) module->Draw( m_canvas, DC, GR_XOR ); wxSize sz = aPad->GetSize(); EXCHG( sz.x, sz.y ); aPad->SetSize( sz ); sz = aPad->GetDrillSize(); EXCHG( sz.x, sz.y ); aPad->SetDrillSize( sz ); wxPoint pt = aPad->GetOffset(); EXCHG( pt.x, pt.y ); aPad->SetOffset( pt ); aPad->SetOffset( wxPoint( aPad->GetOffset().x, -aPad->GetOffset().y ) ); sz = aPad->GetDelta(); EXCHG( sz.x, sz.y ); sz.x = -sz.x; aPad->SetDelta( sz ); module->CalculateBoundingBox(); SetMsgPanel( aPad ); if( DC ) module->Draw( m_canvas, DC, GR_OR );}
开发者ID:Elphel,项目名称:kicad-source-mirror,代码行数:40,
示例18: tst_links_between_blocks/** * Function used by TestForActiveLinksInRatsnest * Function testing the ratsnest between 2 blocks ( of the same net ) * The search is made between pads in block 1 and the others blocks * The block n ( n > 1 ) is merged with block 1 and linked by the smallest ratsnest * between block 1 and the block n (activate the logical connection) * @param aRatsnestBuffer = the buffer to store NETINFO_ITEM* items * @param aNetinfo = the current NETINFO_ITEM for the current net * output: .state member, bit CH_ACTIF of the ratsnest item * @return last subratsnest id in use */static int tst_links_between_blocks( NETINFO_ITEM* aNetinfo, std::vector<RATSNEST_ITEM>& aRatsnestBuffer ){ int subratsnest_id, min_id; RATSNEST_ITEM* link, * best_link; // Search a link from a block to an other block best_link = NULL; for( unsigned ii = aNetinfo->m_RatsnestStartIdx; ii < aNetinfo->m_RatsnestEndIdx; ii++ ) { link = &aRatsnestBuffer[ii]; // If this link joints 2 pads inside the same block, do nothing // (these pads are already connected) if( link->m_PadStart->GetSubRatsnest() == link->m_PadEnd->GetSubRatsnest() ) continue; // This link joints 2 pads of different blocks: this is a candidate, // but we want to select the shorter link, so use it only if it is shorter // than the previous candidate: if( best_link == NULL ) // no candidate best_link = link; else if( best_link->m_Lenght > link->m_Lenght ) // It is a better candidate. best_link = link; } if( best_link == NULL ) return 1; /* At this point we have found a link between 2 different blocks (subratsnest) * we must set its status to ACTIVE and merge the 2 blocks */ best_link->m_Status |= CH_ACTIF; subratsnest_id = best_link->m_PadStart->GetSubRatsnest(); min_id = best_link->m_PadEnd->GetSubRatsnest(); if( min_id > subratsnest_id ) EXCHG( min_id, subratsnest_id ); // Merge the 2 blocks in one sub ratsnest: for( unsigned ii = 0; ii < aNetinfo->m_PadInNetList.size(); ii++ ) { if( aNetinfo->m_PadInNetList[ii]->GetSubRatsnest() == subratsnest_id ) { aNetinfo->m_PadInNetList[ii]->SetSubRatsnest( min_id ); } } return subratsnest_id;}
开发者ID:jerkey,项目名称:kicad,代码行数:62,
示例19: compute_Ratsnest_PlaceModuledouble compute_Ratsnest_PlaceModule( BOARD* aBrd ){ double curr_cost; wxPoint start; // start point of a ratsnest wxPoint end; // end point of a ratsnest int dx, dy; if( ( aBrd->m_Status_Pcb & RATSNEST_ITEM_LOCAL_OK ) == 0 ) return -1; curr_cost = 0; for( unsigned ii = 0; ii < aBrd->m_LocalRatsnest.size(); ii++ ) { RATSNEST_ITEM* pt_local_rats_nest = &aBrd->m_LocalRatsnest[ii]; if( ( pt_local_rats_nest->m_Status & LOCAL_RATSNEST_ITEM ) ) continue; // Skip ratsnest between 2 pads of the current module // Skip modules not inside the board area MODULE* module = pt_local_rats_nest->m_PadEnd->GetParent(); if( !RoutingMatrix.m_BrdBox.Contains( module->GetPosition() ) ) continue; start = pt_local_rats_nest->m_PadStart->GetPosition() - g_Offset_Module; end = pt_local_rats_nest->m_PadEnd->GetPosition(); // Cost of the ratsnest. dx = end.x - start.x; dy = end.y - start.y; dx = abs( dx ); dy = abs( dy ); // ttry to have always dx >= dy to calculate the cost of the rastsnet if( dx < dy ) EXCHG( dx, dy ); // Cost of the connection = lenght + penalty due to the slope // dx is the biggest lenght relative to the X or Y axis // the penalty is max for 45 degrees ratsnests, // and 0 for horizontal or vertical ratsnests. // For Horizontal and Vertical ratsnests, dy = 0; double conn_cost = hypot( dx, dy * 2.0 ); curr_cost += conn_cost; // Total cost = sum of costs of each connection } return curr_cost;}
开发者ID:BTR1,项目名称:kicad-source-mirror,代码行数:50,
示例20: EXCHGvoid VIA::SetLayerPair( LAYER_NUM aTopLayer, LAYER_NUM aBottomLayer ){ if( GetViaType() == VIA_THROUGH ) { aTopLayer = LAYER_N_FRONT; aBottomLayer = LAYER_N_BACK; } if( aBottomLayer > aTopLayer ) EXCHG( aBottomLayer, aTopLayer ); m_Layer = aTopLayer; m_BottomLayer = aBottomLayer;}
开发者ID:johnbeard,项目名称:kicad-source-mirror,代码行数:14,
注:本文中的EXCHG函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ EXCL函数代码示例 C++ EXCEPTION_GATE_RETURN函数代码示例 |