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


C++ CDrawingObject类代码示例

本文整理汇总了C++中CDrawingObject的典型用法代码示例。如果您正苦于以下问题:C++ CDrawingObject类的具体用法?C++ CDrawingObject怎么用?C++ CDrawingObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: GetDrawingBegin

// Replace all of the symbols in our drawing with a different one...
void CTinyCadDoc::ReplaceSymbol( hSYMBOL old_symbol, hSYMBOL new_symbol, bool keep_old_fields )
{
  // Search for methods, and look at their pins
	drawingIterator it = GetDrawingBegin();
	while (it != GetDrawingEnd()) 
	{
		CDrawingObject *ObjPtr = *it;
		if (ObjPtr->GetType() == xMethodEx3)
		{
			CDrawMethod *pMethod = static_cast<CDrawMethod*>(ObjPtr);
			pMethod->ReplaceSymbol( old_symbol, new_symbol, keep_old_fields );
			pMethod->Display( TRUE );
		}

		++ it;
	}
}
开发者ID:saranyan,项目名称:tinycad_graph_matching,代码行数:18,代码来源:TinyCadDoc.cpp

示例2: Delete

// Remove an item from the drawing...
void CTinyCadDoc::Delete( drawingIterator it)
{
	CDrawingObject *pointer = *it;

	pointer->Display();
	if (pointer == GetSelectable())
	{
		SetSelectable( NULL );
	}
	UnSelect(pointer);

	MarkDeleteForUndo( *it );
	delete *it;
	m_drawing.erase( it );

	SetModifiedFlag( TRUE );
}
开发者ID:saranyan,项目名称:tinycad_graph_matching,代码行数:18,代码来源:TinyCadDoc.cpp

示例3: GetPart

// Set which part in the package to edit
void CTinyCadSymbolDoc::EditPartInPackage( int p )
{
	int OldPart = GetPart();
	
	// Get rid of any drawing tool
	SelectObject(new CDrawEditItem(this));

	m_part = p;

	// Are there any pins selected for this part
	int innew = FALSE,inold = FALSE;

	drawingIterator it = GetDrawingBegin();
	while (it != GetDrawingEnd()) 
	{
		CDrawingObject *pointer = *it;

		if (pointer->GetType()==xPinEx && ((CDrawPin *)pointer)->GetPart()==GetPart())
				innew = TRUE;
		if (pointer->GetType()==xPinEx && ((CDrawPin *)pointer)->GetPart()==OldPart)
				inold = TRUE;
		
		++ it;
	}

	// Do we need to copy over the pins?
	if (!innew && inold && Message(IDS_COPYPINS,MB_YESNO | MB_ICONQUESTION)==IDYES) 
	{
		CDrawPin *NewPin;
		drawingIterator it = GetDrawingBegin();
		while (it != GetDrawingEnd()) 
		{
			CDrawingObject *pointer = *it;
			if (pointer->GetType()==xPinEx && ((CDrawPin *)pointer)->GetPart()==OldPart) {
				NewPin = new CDrawPin(this);
				*NewPin = *((CDrawPin *)pointer);
				NewPin->SetPart(GetPart());
				Add(NewPin);
			}
			
			++ it;
		}
	}

	Invalidate();
}
开发者ID:saranyan,项目名称:tinycad_graph_matching,代码行数:47,代码来源:TinyCadSymbolDoc.cpp

示例4: GetDrawingBegin

int CTinyCadSymbolDoc::GetPartsPerPackage()
{
	// Find out how many parts in this package
	int max=0;
	drawingIterator it = GetDrawingBegin();
	while (it != GetDrawingEnd()) 
	{
		CDrawingObject *pointer = *it;

		if (pointer->GetType()==xPinEx && ((CDrawPin *)pointer)->GetPart()>max)
		{
			max = ((CDrawPin *)pointer)->GetPart();
		}

		++ it;
	}

	return max + 1;
}
开发者ID:saranyan,项目名称:tinycad_graph_matching,代码行数:19,代码来源:TinyCadSymbolDoc.cpp

示例5: SelectObject

// Remove all errors from this design
void CTinyCadDoc::DeleteErrors()
{
  // Get rid of any drawing tool
  SelectObject(new CDrawEditItem(this));

	drawingIterator it = GetDrawingBegin();
	while (it != GetDrawingEnd()) 
	{
		drawingIterator current = it;
		++ it;
		
		CDrawingObject *pointer = *current;
		if (pointer->GetType()==xError) 
		{
			m_drawing.erase(current);
			delete pointer;
		}
	}

	Invalidate();
}
开发者ID:saranyan,项目名称:tinycad_graph_matching,代码行数:22,代码来源:TinyCadDoc.cpp

示例6: j

// Delete the selected objects!
void CTinyCadDoc::SelectDelete()
{
  if (!IsSelected())
	return;

    CJunctionUtils j( this );

	drawingIterator it = GetDrawingBegin();
	while (it != GetDrawingEnd()) 
	{
		drawingIterator current = it;
		++ it;

		CDrawingObject *pointer = *current;
		if (IsSelected( pointer ))
		{
			if (pointer == GetSelectable())
			{
				SetSelectable( NULL );
			}

			j.AddObjectToTodo( pointer );
			MarkDeleteForUndo( pointer );
			m_drawing.erase( current );
			pointer->Display();
			delete pointer;
		}
	}

	m_selected.erase( m_selected.begin(), m_selected.end() );

  // ... and perform the junction requirements...
  j.CheckTodoList( true );

  SetModifiedFlag( TRUE );
}
开发者ID:saranyan,项目名称:tinycad_graph_matching,代码行数:37,代码来源:TinyCadDoc.cpp

示例7: theDialog

// Auto anotate the design
void CTinyCadView::OnSpecialAnotate()
{
  CDlgAnotateBox theDialog(this,theASetup);

  // Get rid of any drawing tool
  GetCurrentDocument()->SelectObject(new CDrawEditItem(GetCurrentDocument()));

  // Do the dialog
  int action = theDialog.DoModal();
  
  if (action == IDC_REF_PAINTER)
  {
	  theASetup = theDialog.v;
	  GetCurrentDocument()->SelectObject(new CDrawRefPainter(GetCurrentDocument(), theASetup.startval ));
	  return;
  }
  else if (action !=IDOK)
  {
	return;
  }

  theASetup = theDialog.v;

  // Set the busy icon
  SetCursor( AfxGetApp()->LoadStandardCursor( IDC_WAIT ) );
  

  // Now add/remove references
  CDrawMethod *thisMethod;
  CSymbolRecord *thisSymbol;
  int value=0;
  int part=0;
  BOOL IsSet,IsMatch,MissingSymbols=FALSE;
  

	for (int i = 0; i < 2; i++)
	{
		int sheet = theASetup.all_sheets ? 0 : GetDocument()->GetActiveSheetIndex();

		do
		{
			drawingIterator it = GetDocument()->GetSheet(sheet)->GetDrawingBegin();
			while (it != GetDocument()->GetSheet(sheet)->GetDrawingEnd()) 
			{
				CDrawingObject *pointer = *it;
				// Look for method objects
				if (pointer->GetType() == xMethodEx3) 
				{
					thisMethod = (CDrawMethod *)pointer;
					thisSymbol = thisMethod->GetSymbolData();

					// If there is no symbol then cannot modify this symbol!
					if (thisMethod->IsNoSymbol()) 
					{
						MissingSymbols = TRUE;
						++ it;
						continue;
					}

					// Has this symbol got a reference?
					IsSet   = thisMethod->HasRef();

					switch (theASetup.reference)
					{
					case 0:		// All references
						IsMatch = TRUE;
						break;
					case 1:		// Un-numbered references
						IsMatch = !thisMethod->HasRef();
						break;
					case 2:		// References that match...
						IsMatch = theASetup.matchval == thisSymbol->reference;
						break;
					}

					if (IsMatch)
					{

						// First pass  - we remove references if necessary,
						// Second pass - we add refences back in...
						//
						if (i == 0)
						{
							// Remove any matching references (if necessary)
							if (IsSet && (theASetup.value!=1 || thisMethod->GetRefVal()>=theASetup.startval) ) 
							{
								thisMethod->RemoveReference();
							}
						}
						else
						{
							// Now add back any references
							if (theASetup.action == 0) 
							{
								if (theASetup.reference != 1)
								{
									value = (theASetup.value == 0) ? 1 : theASetup.startval;
								}
								thisMethod->AddReference( value, theASetup.all_sheets );
//.........这里部分代码省略.........
开发者ID:saranyan,项目名称:tinycad_graph_matching,代码行数:101,代码来源:Special.cpp

示例8: GetClientRect


//.........这里部分代码省略.........
				COLORREF col = GetCurrentDocument()->GetOptions()->GetUserColor().Get(CUserColor::BACKGROUND);
				dc.SelectBrush(col, 0);
				dc.SelectPen(PS_SOLID, 1, col);
			}
			dc.Rectangle(CDRect(Start.x - 2, Start.y - 2, End.x + 2, End.y + 2));

			dc.SelectBrush(cOFFPAGE);
			dc.SelectPen(PS_SOLID, 1, cOFFPAGE);

			if (End.x > GetCurrentDocument()->GetDetails().GetPageBoundsAsPoint().x)
			{
				CDPoint a = CDPoint(GetCurrentDocument()->GetDetails().GetPageBoundsAsPoint().x, 0);
				dc.Rectangle(CDRect(a.x, a.y, End.x, End.y));
			}
			if (End.y > GetCurrentDocument()->GetDetails().GetPageBoundsAsPoint().y)
			{
				CDPoint a = CDPoint(Start.x, GetCurrentDocument()->GetDetails().GetPageBoundsAsPoint().y);
				dc.Rectangle(CDRect(a.x, a.y, End.x, End.y));
			}
			if (Start.x < 0) dc.Rectangle(CDRect(0, Start.y, Start.x, End.y));
			if (Start.y < 0) dc.Rectangle(CDRect(Start.x, 0, End.x, Start.y));

			// Fill this region with a grid
			double grid = GetCurrentDocument()->m_snap.GetGrid();
			double SGrid = dc.GetTransform().doubleScale(grid);
			if (GetCurrentDocument()->GetOptions()->ShowGrid() && SGrid > 10)
			{
				double x = dc.GetTransform().GetOrigin().x;
				double y = dc.GetTransform().GetOrigin().y;

				TransformSnap s = GetCurrentDocument()->m_snap;
				s.SetGridSnap(TRUE);

				x = s.Snap(x);
				y = s.Snap(y);

				for (double xp = x >= 0 ? x : 0; xp < End.x && xp < GetCurrentDocument()->GetDetails().GetPageBoundsAsPoint().x; xp += grid)
				{
					for (double yp = y >= 0 ? y : 0; yp < End.y && yp < GetCurrentDocument()->GetDetails().GetPageBoundsAsPoint().y; yp += grid)
					{
						dc.SetPixel(CDPoint(xp, yp), 0);
					}
				}
			}
		}

		Start -= CDPoint(10, 10);
		End += CDPoint(10, 10);

		GetCurrentDocument()->GetSelectBegin();

		drawingIterator it = GetCurrentDocument()->GetDrawingBegin();
		while (it != GetCurrentDocument()->GetDrawingEnd())
		{
			CDrawingObject *obj = *it;

			selected = !pDC->IsPrinting() && GetCurrentDocument()->IsSelected(obj);
			paint_options options = selected ? draw_selected : draw_normal;

			if (!pDC->IsPrinting() || !obj->IsConstruction())
			{
				if (pDC->IsPrinting() || obj->IsInside(Start.x, End.x, Start.y, End.y))
				{
					obj->Paint(dc, options);
				}
			}

			++it;
		}

		// Now draw the selectable object, so it stands out...
		CDrawingObject *obj = GetCurrentDocument()->GetSelectable();
		if (obj != NULL && !GetCurrentDocument()->IsSelected(obj))
		{
			paint_options options = draw_selectable;
			GetCurrentDocument()->GetSelectable()->Paint(dc, options);
		}

		// If only one item is selected then just draw its handles now
		if (GetCurrentDocument()->IsSingleItemSelected())
		{
			GetCurrentDocument()->GetSingleSelectedItem()->PaintHandles(dc);
		}

		// if necessary turn back on the current object to be edited
		if (GetCurrentDocument()->GetEdit() != NULL) {
			//ATLTRACE2("TinyCadView::GetCurrentDocument->GetEdit->Paint(dc, draw_selected=%d)\n",draw_selected);
			GetCurrentDocument()->GetEdit()->Paint(dc, draw_selected);
		}

		// Draw the design details
		GetCurrentDocument()->Display(dc);
	}

	if (osb)
	{
		pDC->BitBlt(client.left, client.top, client.Width(), client.Height(), &BitmapDC, 0, 0, SRCCOPY);
		BitmapDC.SelectObject(old_bitmap);
	}
}
开发者ID:soloveyhappy,项目名称:tiny,代码行数:101,代码来源:Paint.cpp

示例9: SaveXML

//-------------------------------------------------------------------------
void CTinyCadDoc::SaveXML(CXMLWriter &xml, drawingCollection &drawing, BOOL Details, BOOL SaveSelect, BOOL SaveResources )
{
  // Write the objects to the file
  try
  {  
	xml.addTag(GetXMLTag());

	// If necessary write the header stamp
	if (Details) 
	{
		xml.addTag(_T("NAME"));
		xml.addChildData( m_sheet_name );
		xml.closeTag();

		xml.addTag(_T("DETAILS"));
		m_oDetails.WriteXML( xml );
		m_snap.SaveXML( xml );
		xml.closeTag();
	}

	if (SaveResources)
	{
		// Find out which resources are in use
		
		for( drawingIterator i = drawing.begin(); i != drawing.end(); i++ )
		{
			(*i)->TagResources();
		}

		// Save the resource details details
		theOptions.SaveFontsXML(xml);
		theOptions.SaveStylesXML(xml);
		theOptions.SaveFillStylesXML(xml);
		theOptions.SaveMetaFilesXML(xml);
	}

	// Only save the symbols if we are not saving
	// to a library or the header...
	if (Details)
	{
		theOptions.SaveSymbolsXML(xml);
	}

	if (Details)
	{
		theOptions.WriteXML( xml) ;
	}

	for( drawingIterator i = drawing.begin(); i != drawing.end(); i++ )
	{
		CDrawingObject* obj = *i;

		if (obj->GetType() != xError
			&& 	(Details || !obj->IsConstruction()) 
			&&  (!SaveSelect || IsSelected( obj )) )
		{

			// Now save the actual object data
			obj->SaveXML(xml);
		}
	}

	xml.closeTag();

  }
  catch ( CException *e) 
  {
	// Could not save the file properly
    e->ReportError();
    e->Delete();
  }
}
开发者ID:saranyan,项目名称:tinycad_graph_matching,代码行数:73,代码来源:Io.cpp

示例10: while

////// Load a design from a file, loaded design will be selected //////
BOOL CTinyCadDoc::ReadFileXML(CXMLReader &xml, BOOL Details, drawingCollection &drawing, BOOL AlreadyStarted)
{
  try
  {
	// Read in the first item...
	CString name;
	bool sheets = false;

	if (!AlreadyStarted)
	{
		xml.nextTag( name );
		if (name == "TinyCADSheets")
		{
			xml.intoTag();
			sheets = true;
			// We must search for the first TinyCAD section
			while (xml.nextTag( name ) && name != GetXMLTag())
			{
			}
		}
		
		// Check we are at the right point
		if (name != GetXMLTag())
		{
			Message(IDS_ABORTVERSION,MB_ICONEXCLAMATION);
			return FALSE;
		}
	}

	BOOL ResetMerge = TRUE;

	xml.intoTag();

	while (	xml.nextTag( name ) )
	{
		// Save the old layer setting
		CDrawingObject *obj = NULL;

		if (name == "DETAILS" )
		{
			if (Details)
			{
				GetDetails().ReadXML( xml, m_snap );
			}
		}
		else if (name == "NAME")
		{
			if (Details)
			{
				xml.getChildData( m_sheet_name );
			}
		}
		else if (name == "GRID")
		{
			if (Details)
			{
				m_snap.LoadXML( xml );
			}
		}
		else if (name == "FONT")
		{
			if (ResetMerge)
			{
				theOptions.ResetMerge();
				ResetMerge = FALSE;
			}
			theOptions.LoadFontXML(xml);
		}
		else if (name == "STYLE")
		{
			if (ResetMerge)
			{
				theOptions.ResetMerge();
				ResetMerge = FALSE;
			}
			theOptions.LoadStyleXML(xml);
		}
		else if (name == "FILL")
		{
			if (ResetMerge)
			{
				theOptions.ResetMerge();
				ResetMerge = FALSE;
			}
			theOptions.LoadFillStyleXML(xml);
		}
		else if (name == "META" || name == "IMAGE")
		{
			if (ResetMerge)
			{
				theOptions.ResetMerge();
				ResetMerge = FALSE;
			}
			theOptions.LoadMetaFileXML(xml);
		}
		else if (name == "SYMBOLDEF")
		{
			if (ResetMerge)
			{
//.........这里部分代码省略.........
开发者ID:saranyan,项目名称:tinycad_graph_matching,代码行数:101,代码来源:Io.cpp

示例11: ReadFile

//-- Load a design from a file, loaded design will be selected
BOOL CTinyCadDoc::ReadFile(CStream &theArchive, BOOL Details, drawingCollection &drawing)
{
  try
  {
	// Save the old layer setting
	CDrawingObject*	obj		= NULL;
	BYTE			tp		= xNULL;
	CHeaderStamp	oHeader;

	LONG pos = theArchive.GetPos();

	oHeader.Read( theArchive );

	if( ! oHeader.IsChecked(false) )
	{
		// Perhaps this is XML?
		theArchive.Seek(pos);
		CXMLReader xml( &theArchive );
		return ReadFileXML( xml, Details, drawing, FALSE );
	}

	while (tp!=xEndFile) {
		theArchive >> tp;

		switch (tp) {
			case xDesignInformation:
				GetDetails().Read( theArchive );
				break;
			case xDesignInformation2:
				GetDetails().ReadEx( theArchive );
				m_snap.Load( theArchive, Details );
				break;
			case xOptions:
				if( Details )
				{
					theOptions.ReadNative( theArchive );
				}
				else
				{
					COption().ReadNative( theArchive );
				}
				obj = NULL;
				break;
			case xFont:
				theOptions.LoadFonts(theArchive);
				obj = NULL;
				break;
			case xLineStyle:
				theOptions.LoadStyles(theArchive);
				obj = NULL;
				break;
			case xFillStyle:
				theOptions.LoadFillStyles(theArchive);
				obj = NULL;
				break;
			case xMetaFiles:
				theOptions.LoadMetaFiles(theArchive);
				obj = NULL;
				break;
			case xSymbols:
				theOptions.LoadSymbols(theArchive);
				obj = NULL;
				break;
			case xLayerTable:
				{
					// Read in the number of Layers in this list
					CString theNewName;
					WORD NumberOfResources;
					theArchive >> NumberOfResources;

					hRESOURCE OldResourceNumber = 0;

					while (NumberOfResources > 0) {
						theArchive >> OldResourceNumber;
						theArchive >> theNewName;
						NumberOfResources--;
					}
					obj = NULL;
				}
				break;
			case xRuler:
				obj = new CDrawRuler(this,FALSE);
				break;
			case xBus:
				obj = new CDrawLine(this,xBus);
				break;
			case xWire:
				obj = new CDrawLine(this,xWire);
				break;
			case xBusName:
				obj = new CDrawText(this,xBusName);
				break;
			case xBusNameEx:
				obj = new CDrawText(this,xBusNameEx);
				break;
			case xLabel:  	
				obj = new CDrawLabel(this);
				break;
			case xLabelEx:
//.........这里部分代码省略.........
开发者ID:saranyan,项目名称:tinycad_graph_matching,代码行数:101,代码来源:Io.cpp

示例12: SetSelectable

// Redo the last action
void CTinyCadDoc::Redo()
{
	SetSelectable( NULL );
	BOOL action_taken = FALSE;

	// Is this possible?
	while (CanRedo() && !action_taken)
	{


		m_undo_level ++;

		// Re-apply all of the changes we have done at this level
		CDocUndoSet &s = m_undo[ m_undo_level ];


		// Go through the list of action and redo each one 
		//
		CDocUndoSet::actionCollection::iterator act_it = s.m_actions.begin();

		while (act_it != s.m_actions.end())
		{
			CDocUndoSet::CDocUndoAction &act = *act_it;

			// Look up this item from the index...
			drawingCollection::iterator it = m_drawing.begin();
			int index = act.m_index;
			while (index > 0 && it != m_drawing.end())
			{
				++ it;
				-- index;
			}

			if (it != m_drawing.end())
			{
				(*it)->Display();
			}
			act.m_object->Display();

			switch (act.m_action)
			{
			case CDocUndoSet::Deletion:
				// We must re-delete the deleted objects
				delete *it;
				m_drawing.erase( it );
				action_taken = TRUE;
				break;
			case CDocUndoSet::Addition:
				// We must re-insert the additions
				m_drawing.insert( it, Dup(act.m_object) );
				action_taken = TRUE;
				break;
			case CDocUndoSet::Change:
				// We convert the old objects into the new objects...
				{
					// Keep a copy for the redo...
					CDrawingObject *copy = Dup(*it);
					delete *it;

					copy->Display();
					*it = act.m_object;
					act.m_object = copy;
				}
				action_taken = TRUE;
				break;
			}

			++ act_it;
		}
	}
}
开发者ID:saranyan,项目名称:tinycad_graph_matching,代码行数:72,代码来源:TinyCadDoc.cpp

示例13: _tfopen_s

// Create netlist and output as a PCB file
void CNetList::WriteNetListFileTinyCAD( CTinyCadMultiDoc *pDesign, const TCHAR *filename )
{
  FILE *theFile;
  errno_t err;
  err = _tfopen_s(&theFile, filename,_T("w"));
  if ((theFile == NULL) || (err != 0))
  {
	Message(IDS_CANNOTOPEN);
	return;
  }

  // Set the Busy icon
  SetCursor( AfxGetApp()->LoadStandardCursor( IDC_WAIT ) );

  // Get the net list
  MakeNet( pDesign );

  _ftprintf(theFile,NetComment _T(" ====+  Net List for %s  +====\n\n"), pDesign->GetPathName() );


  _ftprintf(theFile,NetComment _T(" ======+ The component list\n\n"));

  // Keep track of the references we have outputted...
  std::set<CString>	referenced;

  	// Do this for all of the files in the imports list...
	fileCollection::iterator fi = m_imports.begin();
	for (;fi != m_imports.end(); ++ fi)
	{
		CTinyCadMultiDoc *dsn = pDesign;

		if ((*fi)->m_file_name_index != 0)
		{
			dsn = (*fi)->m_pDesign;
		}

		// Generate a component for every sheet in this design
		for (int i = 0; i < dsn->GetNumberOfSheets(); i++)
		{
			drawingIterator it = dsn->GetSheet(i)->GetDrawingBegin();
			while (it != dsn->GetSheet(i)->GetDrawingEnd()) 
			{
			CDrawingObject *pointer = *it;

			if (pointer->GetType() == xMethodEx3) 
			{
				CDrawMethod *pMethod = static_cast<CDrawMethod *>(pointer);
				CString Name = pMethod->GetField(CDrawMethod::Name);
				CString Ref  = pMethod->GetRefSheet(m_prefix_references,m_prefix_import,(*fi)->m_file_name_index,i+1);

				// Do we need to output this part?
				if (referenced.find( Ref ) == referenced.end())
				{
					referenced.insert( Ref );

					_ftprintf(theFile,_T("COMPONENT '%s' = %s\n"),Ref,Name);

					// Now write it it's "other" references
					for (int i = 2; i < pMethod->GetFieldCount(); i++)
					{
						_ftprintf(theFile,_T("\tOPTION '%s' = %s\n"),pMethod->GetFieldName(i), pMethod->GetField(i) );
					}
				}
			}
			
			++ it;
			}
		}
	}

  _ftprintf(theFile,_T("\n\n") NetComment _T(" ======+ The net list\n\n"));
  int Label = 0;

  netCollection::iterator nit = m_nets.begin();

	while (nit != m_nets.end()) 
	{
		nodeVector::iterator nv_it = (*nit).second.begin();

		CString theLine,theLabel;

		if (nv_it != (*nit).second.end()) 
		{
			theLine = "";
			BOOL first = TRUE,PrintLine=FALSE, Labeled = FALSE;

			while (nv_it != (*nit).second.end()) 
			{
				CNetListNode& theNode = *nv_it;
				++ nv_it;

				if (theNode.getLabel() != "" && !Labeled) 
				{
					theLabel = theNode.getLabel();
					Labeled = TRUE;
				}
				else
				{
					CString add;
//.........这里部分代码省略.........
开发者ID:saranyan,项目名称:tinycad_graph_matching,代码行数:101,代码来源:NetList.cpp

示例14: switch

// Perform the work of making a netlist from a single sheet in this design...
void CNetList::MakeNetForSheet( fileCollection &imports, int file_index_id, int &file_name_index, int sheet, CTinyCadDoc *pDesign )
{
  // Get rid of any old data
  m_CurrentNet = 1;
  m_nodes.erase( m_nodes.begin(), m_nodes.end() );
  m_nets.erase( m_nets.begin(), m_nets.end() );

  // Here is some temporary data for this function
  typedef std::map<CString,int> stringCollection;
  stringCollection	Powers;
  stringCollection	Connected;

  // Search for nodes, and build the node tree
  drawingIterator it = pDesign->GetDrawingBegin();
  for (;it != pDesign->GetDrawingEnd(); ++ it ) 
  {
	CDrawingObject *ObjPtr = *it;
	stringCollection::iterator found;
	int hold;
	CDPoint tr;

	switch (ObjPtr->GetType()) 
	{
		case xHierarchicalSymbol:
			{
				CDrawHierarchicalSymbol *pSymbol = static_cast<CDrawHierarchicalSymbol*>(ObjPtr);

				// Try and stop recursion by limiting the number of imports
				if (imports.size() > 100)
				{
					AfxMessageBox( IDS_RECURSION );
					continue;
				}

				// Push back this filename into the list of extra imports
				CImportFile *f = new CImportFile;
				++ file_name_index;
				f->m_file_name_index = file_name_index;
				if (f->Load( pSymbol->GetFilename() ) )
				{
					imports.push_back( f );

					// Now search the symbol for pins to link the other symbols to
					drawingCollection method;
					pSymbol->ExtractSymbol(tr,method);

					drawingIterator it = method.begin();
					while ( it != method.end() ) 
					{
						CDrawingObject *pointer = *it;

						if (pointer->GetType()==xPinEx) 
						{
							CDrawPin *thePin = static_cast<CDrawPin*>(pointer);

							// This in effect labels the node with the new node name...
							CNetListNode n( file_name_index, sheet, thePin, thePin->GetActivePoint(pSymbol) );
							n.setLabel( thePin->GetPinName() );
							n.m_reference = pSymbol->GetRefSheet(m_prefix_references,m_prefix_import,file_index_id,sheet);
							n.m_pin = thePin->GetNumber();
							n.m_pMethod = pSymbol;
							Add(n);
						}

						++ it;
					}
				}
				else
				{
					delete f;
				}
			}
			break;
		case xMethodEx3:
			#define thePin ((CDrawPin*)pointer)
			#define theMethod ((CDrawMethod*)ObjPtr)
			{
				drawingCollection method;
				((CDrawMethod *)ObjPtr)->ExtractSymbol(tr,method);

				drawingIterator it = method.begin();
				while ( it != method.end() ) 
				{
					CDrawingObject *pointer = *it;

					if (pointer->GetType()==xPinEx && !(thePin->IsPower()) ) 
					{
						CNetListNode n( file_index_id, sheet, thePin,thePin->GetActivePoint(theMethod));
						n.m_reference = theMethod->GetRefSheet(m_prefix_references,m_prefix_import,file_index_id,sheet);
						n.m_pin = thePin->GetNumber();
						n.m_pMethod = theMethod;
						Add(n);
					}

					++ it;
				}

				// Has this symbol had it's power connected?
				if (Connected.find(theMethod->GetRefSheet(m_prefix_references,m_prefix_import,file_index_id,sheet)) == Connected.end()) 
//.........这里部分代码省略.........
开发者ID:saranyan,项目名称:tinycad_graph_matching,代码行数:101,代码来源:NetList.cpp

示例15: r

CDPoint CTinyCadDoc::GetStickyPoint( CDPoint q, BOOL pins, BOOL wires, BOOL &is_stuck, BOOL &is_junction )
{
  CDPoint r(0,0);
  bool first = true;
  double min_distance = 0;
  int items = 0;

  int range = GetOption().GetAutoSnapRange();

  if (!GetOption().GetAutoSnap())
  {
  	  is_stuck = FALSE;
	  is_junction = FALSE;
	  return q;
  }


  // Search for methods, and look at their pins
	drawingIterator it = GetDrawingBegin();
	while (it != GetDrawingEnd()) 
	{
		CDrawingObject *ObjPtr = *it;

		switch (ObjPtr->GetType()) 
		{
			case xWire:
				#define theLine ((CDrawLine*)ObjPtr)
				if (wires)
				{
					CDPoint d;
					CLineUtils l( theLine->m_point_a, theLine->m_point_b );
					double distance = l.DistanceFromPoint( q, d );

					if (d == r)
					{
						items ++;
					}

					if (first || distance < min_distance)
					{
						if (r != d)
						{
							// have we split this wire?
							if (d != theLine->m_point_a && d != theLine->m_point_b)
							{
								items = 2;
							}
							else
							{
								items = 1;
							}
						}
						r = d;
						first = false;
						min_distance = distance;
					}
				}
				break;
			default:
				if (pins)
				{
					CDRect s( ObjPtr->m_point_a.x, ObjPtr->m_point_a.y, ObjPtr->m_point_b.x, ObjPtr->m_point_b.y );
					s.NormalizeRect();
					s.left -= range * 2;
					s.right += range * 2;
					s.bottom += range * 2;
					s.top -= range * 2;

					if (s.PtInRect(q))
					{
						CActiveNode a;
						ObjPtr->GetActiveListFirst( a );
						while (ObjPtr->GetActive(a)) 
						{
							// This is a valid pin...
							CDPoint d = a.m_a;
							double dx = d.x - q.x;
							double dy = d.y - q.y;
							double distance = sqrt(dx*dx + dy*dy);

							if (r == d)
							{
								items ++;
							}

							if (first || distance < min_distance)
							{
								if (r != d)
								{
									items = 1;
								}

								r = d;
								first = false;
								min_distance = distance;
							}
						}
					}
				}
				break;
//.........这里部分代码省略.........
开发者ID:saranyan,项目名称:tinycad_graph_matching,代码行数:101,代码来源:TinyCadDoc.cpp


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