ÕâÆª½Ì³ÌC++ Coordº¯Êý´úÂëʾÀýдµÃºÜʵÓã¬Ï£ÍûÄܰﵽÄú¡£
±¾ÎÄÕûÀí»ã×ÜÁËC++ÖÐCoordº¯ÊýµÄµäÐÍÓ÷¨´úÂëʾÀý¡£Èç¹ûÄúÕý¿àÓÚÒÔÏÂÎÊÌ⣺C++ Coordº¯ÊýµÄ¾ßÌåÓ÷¨£¿C++ CoordÔõôÓã¿C++ CoordʹÓõÄÀý×Ó£¿ÄÇô¹§Ï²Äú, ÕâÀᆱѡµÄº¯Êý´úÂëʾÀý»òÐí¿ÉÒÔΪÄúÌṩ°ïÖú¡£ ÔÚÏÂÎÄÖÐÒ»¹²Õ¹Ê¾ÁËCoordº¯ÊýµÄ20¸ö´úÂëʾÀý£¬ÕâЩÀý×ÓĬÈϸù¾ÝÊÜ»¶Ó³Ì¶ÈÅÅÐò¡£Äú¿ÉÒÔΪϲ»¶»òÕ߸оõÓÐÓõĴúÂëµãÔÞ£¬ÄúµÄÆÀ¼Û½«ÓÐÖúÓÚÎÒÃǵÄÏµÍ³ÍÆ¼ö³ö¸ü°ôµÄC++´úÂëʾÀý¡£ ʾÀý1: Sprite DrawableSprite::DrawableSprite() : Sprite ( Coord(), Coord ( 1, 1 ), 0, 1 ) { //ctor }
¿ª·¢ÕßID:ebonywolf£¬ÏîÄ¿Ãû³Æ:AgentesCataLixo£¬´úÂëÐÐÊý:4£¬
ʾÀý2: while void Menubar::_render( GfxDevice * pDevice, const Rect& _canvas, const Rect& _window, const Rect& _clip ) { Widget::_render(pDevice,_canvas,_window,_clip); // Take backgrounds content borders into account Rect window; Rect clip; if( m_pSkin ) { window = m_pSkin->contentRect( _canvas, m_state ); clip.intersection( window, _clip ); } else { window = _canvas; clip = _clip; } // Go throught the MenuBarItems and print their text and render their rectangles. MenuBarItem * pI = m_items.first(); uint32_t posX = window.x; Pen pen; TextAttr attr; TextTool::addPropAttributes( attr, Base::getDefaultTextprop(), StateEnum::Normal); TextTool::addPropAttributes( attr, m_pTextProp, StateEnum::Normal); pen.setAttributes( attr ); pen.setClipRect( clip ); pen.setDevice( pDevice ); uint32_t printPosY = window.y + ( window.h - pen.getLineHeight() )/2 + pen.getBaseline(); uint32_t itemNb = 1; while( pI ) { if( pI->isVisible() ) { State state = StateEnum::Disabled; if( m_state.isEnabled() && pI->m_bEnabled ) { state = StateEnum::Normal; if( itemNb == m_selectedItem ) state = StateEnum::Pressed; else if( itemNb == m_markedItem ) state = StateEnum::Hovered; } Border b = _getEntryBorder(); // ColorsetPtr pTextColors; // if( m_pSkin ) // pTextColors = m_pSkin->TextColors(); if( m_pEntrySkin ) { Rect dest( posX, window.y, pI->m_width + b.width(), window.h ); m_pEntrySkin->render( pDevice, dest, state, clip ); // pTextColors = m_pEntrySkin->TextColors(); } pen.setPos( Coord(posX + b.left, printPosY) ); TextAttr attr; TextTool::addPropAttributes( attr, Base::getDefaultTextprop(), state ); // TextTool::setAttrColor( attr, pTextColors, mode ); TextTool::addPropAttributes( attr, m_pTextProp, state ); pen.setAttributes( attr ); pDevice->printLine( pen, attr, pI->m_pText ); posX += pI->m_width + b.width(); } itemNb++; pI = pI->next(); } }
¿ª·¢ÕßID:tordj£¬ÏîÄ¿Ãû³Æ:WonderGUI£¬´úÂëÐÐÊý:85£¬
ʾÀý3: Coord/** * Applique l'op¨¦rateur modulo sur les deux coordonn¨¦es. */Coord Coord::operator%(const int n) const{ return Coord(this->x % n, this->y % n);}
¿ª·¢ÕßID:Celebrom£¬ÏîÄ¿Ãû³Æ:PolyA2013£¬´úÂëÐÐÊý:7£¬
ʾÀý4: item/** This function returns the size of the specified item. /param ItemID the id of the item (e.g. Structure_HeavyFactory) /return a Coord containg the size (e.g. (3,2) ). Returns (0,0) on error.*/Coord getStructureSize(int itemID) { switch(itemID) { case Structure_Barracks: return Coord(2,2); break; case Structure_ConstructionYard: return Coord(2,2); break; case Structure_GunTurret: return Coord(1,1); break; case Structure_HeavyFactory: return Coord(3,2); break; case Structure_HighTechFactory: return Coord(3,2); break; case Structure_IX: return Coord(2,2); break; case Structure_LightFactory: return Coord(2,2); break; case Structure_Palace: return Coord(3,3); break; case Structure_Radar: return Coord(2,2); break; case Structure_Refinery: return Coord(3,2); break; case Structure_RepairYard: return Coord(3,2); break; case Structure_RocketTurret: return Coord(1,1); break; case Structure_Silo: return Coord(2,2); break; case Structure_StarPort: return Coord(3,3); break; case Structure_Slab1: return Coord(1,1); break; case Structure_Slab4: return Coord(2,2); break; case Structure_Wall: return Coord(1,1); break; case Structure_WindTrap: return Coord(2,2); break; case Structure_WOR: return Coord(2,2); break; default: return Coord(0,0); break; } return Coord(0,0);}
¿ª·¢ÕßID:binarycrusader£¬ÏîÄ¿Ãû³Æ:dunelegacy£¬´úÂëÐÐÊý:32£¬
ʾÀý5: CoordCoord operator-(Coord coord1,Coord coord2){ return Coord(coord1.x()-coord2.x(),coord1.y()-coord2.y(),coord1.z()-coord2.z(),coord1.ex()-coord2.ex(),coord1.ey()-coord2.ey(),coord1.ez()-coord2.ez());}
¿ª·¢ÕßID:narumiya£¬ÏîÄ¿Ãû³Æ:program£¬´úÂëÐÐÊý:3£¬
ʾÀý6: Apple Apple() { _value = 10; _type = NORMAL_APPLE; _pos = Coord(0, 0); }
¿ª·¢ÕßID:Hiruxou£¬ÏîÄ¿Ãû³Æ:Epitech-2£¬´úÂëÐÐÊý:5£¬
ʾÀý7: glPushMatrixvoid GlAxisBoxPlot::draw(float lod,Camera* camera) { float rotationAngle = axis->getRotationAngle(); if (rotationAngle != 0) { glPushMatrix(); glRotatef(rotationAngle, 0.0f, 0.0f, 1.0f); } bottomOutlierCoord = axis->getBottomOutlierCoord(); firstQuartileCoord = axis->getFirstQuartileCoord(); medianCoord = axis->getMedianCoord(); thirdQuartileCoord = axis->getThirdQuartileCoord(); topOutlierCoord = axis->getTopOutlierCoord(); Coord interQuartileRangeBoxCoords[4]; if (axis->hasAscendingOrder()) { boundingBox.expand(Coord(bottomOutlierCoord.getX() - boxWidth / 2.0f, bottomOutlierCoord.getY(), 0.0f)); boundingBox.expand(Coord(topOutlierCoord.getX() + boxWidth / 2.0f, topOutlierCoord.getY(), 0.0f)); interQuartileRangeBoxCoords[0] = Coord(thirdQuartileCoord.getX() - boxWidth / 2.0f, thirdQuartileCoord.getY(), 0.0f); interQuartileRangeBoxCoords[1] = Coord(thirdQuartileCoord.getX() + boxWidth / 2.0f, thirdQuartileCoord.getY(), 0.0f); interQuartileRangeBoxCoords[2] = Coord(firstQuartileCoord.getX() + boxWidth / 2.0f, firstQuartileCoord.getY(), 0.0f); interQuartileRangeBoxCoords[3] = Coord(firstQuartileCoord.getX() - boxWidth / 2.0f, firstQuartileCoord.getY(), 0.0f); } else { boundingBox.expand(Coord(topOutlierCoord.getX() - boxWidth / 2.0f, topOutlierCoord.getY(), 0.0f)); boundingBox.expand(Coord(bottomOutlierCoord.getX() + boxWidth / 2.0f, bottomOutlierCoord.getY(), 0.0f)); interQuartileRangeBoxCoords[0] = Coord(firstQuartileCoord.getX() - boxWidth / 2.0f, firstQuartileCoord.getY(), 0.0f); interQuartileRangeBoxCoords[1] = Coord(firstQuartileCoord.getX() + boxWidth / 2.0f, firstQuartileCoord.getY(), 0.0f); interQuartileRangeBoxCoords[2] = Coord(thirdQuartileCoord.getX() + boxWidth / 2.0f, thirdQuartileCoord.getY(), 0.0f); interQuartileRangeBoxCoords[3] = Coord(thirdQuartileCoord.getX() - boxWidth / 2.0f, thirdQuartileCoord.getY(), 0.0f); } GlQuad interQuartileRangeBox(interQuartileRangeBoxCoords[0], interQuartileRangeBoxCoords[1], interQuartileRangeBoxCoords[2], interQuartileRangeBoxCoords[3], fillColor); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA,GL_SRC_COLOR); glEnable(GL_LIGHTING); interQuartileRangeBox.draw(lod, camera); glDisable(GL_BLEND); glDisable(GL_LIGHTING); glEnable(GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); GlLines::glDrawLine(interQuartileRangeBoxCoords[0], interQuartileRangeBoxCoords[1], 2, GlLines::TLP_PLAIN, outlineColor, outlineColor); GlLines::glDrawLine(interQuartileRangeBoxCoords[1], interQuartileRangeBoxCoords[2], 2, GlLines::TLP_PLAIN, outlineColor, outlineColor); GlLines::glDrawLine(interQuartileRangeBoxCoords[2], interQuartileRangeBoxCoords[3], 2, GlLines::TLP_PLAIN, outlineColor, outlineColor); GlLines::glDrawLine(interQuartileRangeBoxCoords[3], interQuartileRangeBoxCoords[0], 2, GlLines::TLP_PLAIN, outlineColor, outlineColor); GlLines::glDrawLine(bottomOutlierCoord + Coord(-(boxWidth / 2.0f), 0.0f, 0.0f), bottomOutlierCoord + Coord(boxWidth / 2.0f, 0.0f, 0.0f), 2, GlLines::TLP_PLAIN, outlineColor, outlineColor); GlLines::glDrawLine(medianCoord + Coord(-(boxWidth / 2.0f), 0.0f, 0.0f), medianCoord + Coord(boxWidth / 2.0f, 0.0f, 0.0f), 2, GlLines::TLP_PLAIN, outlineColor, outlineColor); GlLines::glDrawLine(topOutlierCoord + Coord(-(boxWidth / 2.0f), 0.0f, 0.0f), topOutlierCoord + Coord(boxWidth / 2.0f, 0.0f, 0.0f), 2, GlLines::TLP_PLAIN, outlineColor, outlineColor); GlLines::glDrawLine(bottomOutlierCoord, firstQuartileCoord, 2, GlLines::TLP_DASHED, outlineColor, outlineColor); GlLines::glDrawLine(thirdQuartileCoord, topOutlierCoord, 2, GlLines::TLP_DASHED, outlineColor, outlineColor); glDisable(GL_BLEND); drawLabel(bottomOutlierCoord, axis->getBottomOutlierStringValue(),camera); drawLabel(firstQuartileCoord, axis->getFirstQuartileStringValue(),camera); drawLabel(medianCoord, axis->getMedianStringValue(),camera); drawLabel(thirdQuartileCoord, axis->getThirdQuartileStringValue(),camera); drawLabel(topOutlierCoord, axis->getTopOutlierStringValue(),camera); if (highlightRangeLowBound != NULL && highlightRangeHighBound != NULL) { Coord highlightBoxCoords[4] = { Coord(highlightRangeHighBound->getX() - boxWidth / 2.0f, highlightRangeHighBound->getY(), 0.0f), Coord(highlightRangeHighBound->getX() + boxWidth / 2.0f, highlightRangeHighBound->getY(), 0.0f), Coord(highlightRangeLowBound->getX() + boxWidth / 2.0f, highlightRangeLowBound->getY(), 0.0f), Coord(highlightRangeLowBound->getX() - boxWidth / 2.0f, highlightRangeLowBound->getY(), 0.0f) }; Color outlineColorTranslucent(outlineColor); outlineColorTranslucent.setA(10); GlQuad highlightBox(highlightBoxCoords[0], highlightBoxCoords[1], highlightBoxCoords[2], highlightBoxCoords[3], outlineColorTranslucent); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA,GL_SRC_COLOR); glEnable(GL_LIGHTING); highlightBox.draw(lod, camera); glDisable(GL_BLEND); glDisable(GL_LIGHTING); highlightRangeLowBound = NULL; highlightRangeHighBound = NULL; } if (rotationAngle != 0.0f) { glPopMatrix(); }}
¿ª·¢ÕßID:mneumann£¬ÏîÄ¿Ãû³Æ:tulip£¬´úÂëÐÐÊý:89£¬
ʾÀý8: __compute_upstatic inlineCoord __compute_up(unit_t NX, unit_t NY){ return Coord(NX,__half_NY(NY)-1);}
¿ª·¢ÕßID:ybouret£¬ÏîÄ¿Ãû³Æ:iics£¬´úÂëÐÐÊý:5£¬
ʾÀý9: __compute_lostatic inlineCoord __compute_lo(unit_t NY){ return Coord(0,-__half_NY(NY) );}
¿ª·¢ÕßID:ybouret£¬ÏîÄ¿Ãû³Æ:iics£¬´úÂëÐÐÊý:5£¬
ʾÀý10: latlonInverse inline Coord latlonInverse(const QPointF& point) const { return Coord(point.x()/*/EQUATORIALMETERPERDEGREE*/, point.y()/*/EQUATORIALMETERPERDEGREE*/); }
¿ª·¢ÕßID:4x4falcon£¬ÏîÄ¿Ãû³Æ:fosm-merkaartor£¬´úÂëÐÐÊý:4£¬
ʾÀý11: SetUp virtual void SetUp() { ModuleNodePointer module = Utility::getPointer(new RectangularModuleFactory("module1")); module->addShape(Utility::getPointer(new RectangularShape("0", Coord(1, 1, 1)))); module->addShape(Utility::getPointer(new RectangularShape("1", Coord(1, 1, 2)))); graph->add(module); }
¿ª·¢ÕßID:yuczhou£¬ÏîÄ¿Ãû³Æ:Biochip£¬´úÂëÐÐÊý:6£¬
ʾÀý12: CoordCoord Coord::operator+( const Coord& src ) const{ return Coord( this->x + src.x, this->y + src.y, this->z + src.z, this->map );}
¿ª·¢ÕßID:BackupTheBerlios£¬ÏîÄ¿Ãû³Æ:wolfpack-svn£¬´úÂëÐÐÊý:4£¬
|