private void UpdateSingleRenders(GEMSProject.DataChangedEventArgs e) { if (e.changedSingle is GEMSSingle) { GEMSSingle changedSingle = e.changedSingle as GEMSSingle; switch (e.changedType) { case GEMSProject.DataChangedEventArgs.DataChangeType.SingleCutted: case GEMSProject.DataChangedEventArgs.DataChangeType.SingleDeleted: { //Delete one single painter GEMSSingleRender targetSingleRender = null; foreach (GEMSSingleRender singleRender in singleRenders) { if (singleRender.Source == changedSingle) { targetSingleRender = singleRender; } } this.singleRenders.Remove(targetSingleRender); targetSingleRender.Dispose( ); } break; case GEMSProject.DataChangedEventArgs.DataChangeType.SinglePasted: case GEMSProject.DataChangedEventArgs.DataChangeType.SingleCreated: //Create one single painter { GEMSSingleRender newSingleRender = new GEMSSingleRender(d3d, changedSingle, this); newSingleRender.Initialize( ); this.singleRenders.Add(newSingleRender); } break; } } //Re-generate bounding box GenerateBoundingBox( ); if (currentMode == SceneMode.Preview) { isFit = true; } }
/// <summary> /// Create single painters for each single object /// </summary> private void CreateSingleRenders( ) { foreach (GEMSSingleRender singleRender in singleRenders) { singleRender.Dispose( ); } singleRenders.Clear( ); if (m_project != null && m_project.Singles != null) { foreach (GEMSSingle single in m_project.Singles) { GEMSSingleRender render = new GEMSSingleRender(d3d, single, this); render.Initialize( ); singleRenders.Add(render); } GenerateBoundingBox( ); } }