int SimpleParticle::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags) { if (!OKtoDisplay(t)) return 0; Update(t,inode); GraphicsWindow *gw = vpt->getGW(); DWORD rlim = gw->getRndLimits(); // Draw emitter gw->setRndLimits(GW_WIREFRAME|GW_EDGES_ONLY|GW_BACKCULL| (rlim&GW_Z_BUFFER) ); if (inode->Selected()) gw->setColor( LINE_COLOR, GetSelColor()); else if(!inode->IsFrozen()) //gw->setColor( LINE_COLOR, particleMtl.Kd[0], particleMtl.Kd[1], particleMtl.Kd[2]); gw->setColor(LINE_COLOR,GetUIColor(COLOR_PARTICLE_EM)); if (EmitterVisible()) { gw->setTransform(inode->GetObjTMBeforeWSM(t)); mesh.render(gw, &particleMtl, (flags&USE_DAMAGE_RECT) ? &vpt->GetDammageRect() : NULL, COMP_ALL); } // Draw particles gw->setRndLimits(GW_WIREFRAME|GW_EDGES_ONLY|GW_BACKCULL| (rlim&(GW_Z_BUFFER|GW_BOX_MODE)) ); Material *mtl = gw->getMaterial(); if (!inode->Selected() && !inode->IsFrozen()) gw->setColor( LINE_COLOR, mtl->Kd[0], mtl->Kd[1], mtl->Kd[2]); gw->setTransform(ident); parts.Render(gw,GetMarkerType()); gw->setRndLimits(rlim); return(0); }
int SimpleParticle::HitTest( TimeValue t, INode *inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt) { Update(t,inode); Point2 pt( (float)p[0].x, (float)p[0].y ); HitRegion hitRegion; GraphicsWindow *gw = vpt->getGW(); MakeHitRegion(hitRegion, type, crossing, 4, p); DWORD rlim = gw->getRndLimits(); int res; gw->setTransform(ident); if (parts.HitTest(gw,&hitRegion,flags&HIT_ABORTONHIT,GetMarkerType())) { return TRUE; } if (EmitterVisible()) { gw->setRndLimits((rlim|GW_PICK|GW_WIREFRAME) & ~(GW_ILLUM|GW_BACKCULL|GW_FLAT|GW_SPECULAR)); gw->setTransform(inode->GetObjTMBeforeWSM(t)); res = mesh.select(gw, &particleMtl, &hitRegion, flags & HIT_ABORTONHIT); gw->setRndLimits(rlim); } else { res = 0; } return res; }
// Add a popup menu for the different marker types and frequencies void CXYChart::AddMarkerPopup( CMenu *addMenu, LPCTSTR titleString, int dataID, int startVal ) { CMenu subMenu; int i, markerShape, freq; CString string; UINT flag; subMenu.CreatePopupMenu(); // Marker shape markerShape = GetMarkerType( dataID ); flag = GetPopupCheckedFlag( markerShape == kXYMarkerNone ); addMenu->AppendMenu( MF_STRING | flag, startVal+kXYMarkerNone, _T("No marker")); flag = GetPopupCheckedFlag( markerShape == kXYMarkerCircle ); addMenu->AppendMenu( MF_STRING | flag, startVal+kXYMarkerCircle, _T("Circle marker")); flag = GetPopupCheckedFlag( markerShape == kXYMarkerSquare ); addMenu->AppendMenu( MF_STRING | flag, startVal+kXYMarkerSquare, _T("Square marker")); flag = GetPopupCheckedFlag( markerShape == kXYMarkerTriangle ); addMenu->AppendMenu( MF_STRING | flag, startVal+kXYMarkerTriangle, _T("Triangle marker")); flag = GetPopupCheckedFlag( markerShape == kXYMarkerX ); addMenu->AppendMenu( MF_STRING | flag, startVal+kXYMarkerX, _T("X marker")); addMenu->AppendMenu( MF_SEPARATOR); flag = GetPopupCheckedFlag( GetMarkerFillState( dataID ) ); addMenu->AppendMenu( MF_STRING | flag, startVal+kMenuMarkerFill, _T("Filled marker")); addMenu->AppendMenu( MF_SEPARATOR); // Marker size for( i = 0; i < nMarkerSizes; i++ ) { flag = GetPopupCheckedFlag( GetMarkerSize( dataID ) == 10*(i+1) ); string.Format( _T("%d"), i+1 ); subMenu.AppendMenu( MF_STRING | flag, startVal+i+kMenuMarkerSize, string ); } addMenu->AppendMenu( MF_POPUP, (UINT) subMenu.GetSafeHmenu(), _T("Marker size")); // Marker frequency freq = abs(GetMarkerFrequency( dataID )); if( freq == 1 ) freq = 10; flag = GetPopupCheckedFlag( GetMarkerFrequency( dataID ) == 1 ); addMenu->AppendMenu( MF_STRING | flag, startVal+kMenuMarkerFrequency, _T("Mark every point")); flag = GetPopupCheckedFlag( (GetMarkerFrequency( dataID )) > 1 ); string.Format( _T("Mark every %d points"), freq ); addMenu->AppendMenu( MF_STRING | flag, startVal+kMenuMarkerFrequency+1, string ); flag = GetPopupCheckedFlag( (GetMarkerFrequency( dataID )) < 0 ); string.Format( _T("Mark %d points"), freq ); addMenu->AppendMenu( MF_STRING | flag, startVal+kMenuMarkerFrequency+2, string ); }
void SCH_MARKER::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor ) { COLOR4D color = m_Color; COLOR4D tmp = color; if( GetMarkerType() == MARKER_BASE::MARKER_ERC ) { color = ( GetErrorLevel() == MARKER_BASE::MARKER_SEVERITY_ERROR ) ? GetLayerColor( LAYER_ERC_ERR ) : GetLayerColor( LAYER_ERC_WARN ); } if( aColor == COLOR4D::UNSPECIFIED ) m_Color = color; else m_Color = aColor; DrawMarker( aPanel, aDC, aDrawMode, aOffset ); m_Color = tmp; }
void CClientMarker::SetMarkerType ( CClientMarker::eMarkerType eType ) { // Different from current type? eMarkerType eCurrentType = GetMarkerType (); if ( eCurrentType != eType ) { // Current type is a checkpoint and new type is a ring? if ( eCurrentType == MARKER_CHECKPOINT && eType == MARKER_RING ) { // Just change the type static_cast < CClientCheckpoint* > ( m_pMarker ) ->SetCheckpointType ( CClientCheckpoint::TYPE_RING ); } // Or current type is a ring and new type is a checkpoint? if ( eCurrentType == MARKER_RING && eType == MARKER_CHECKPOINT ) { // Just change the type static_cast < CClientCheckpoint* > ( m_pMarker ) ->SetCheckpointType ( CClientCheckpoint::TYPE_NORMAL ); } // Current type is a cylinder and new type is an arrow if ( eCurrentType == MARKER_CYLINDER && eType == MARKER_ARROW ) { // Just change the type static_cast < CClient3DMarker* > ( m_pMarker ) ->Set3DMarkerType ( CClient3DMarker::TYPE_ARROW ); } // Current type is an arrow and new type is an cylinder if ( eCurrentType == MARKER_ARROW && eType == MARKER_CYLINDER ) { // Just change the type static_cast < CClient3DMarker* > ( m_pMarker ) ->Set3DMarkerType ( CClient3DMarker::TYPE_CYLINDER ); } // No easy way of changing the type. Different classes. Remember position and color and recreate it. CVector vecPosition; m_pMarker->GetPosition ( vecPosition ); bool bVisible = m_pMarker->IsVisible (); float fSize = m_pMarker->GetSize (); SColor color = m_pMarker->GetColor (); bool bStreamedIn = IsStreamedIn (); // Destroy the old. delete m_pMarker; m_pMarker = NULL; // Create a new one of the correct type CreateOfType ( eType ); // Set the properties back SetPosition ( vecPosition ); SetSize ( fSize ); SetColor ( color ); SetVisible ( bVisible ); // Stream it in if it was streamed in if ( bStreamedIn ) { m_pMarker->StreamIn (); } } }