示例#1
0
void QCSXCAD::ShowHide()
{
	CSProperties* prop = CSTree->GetCurrentProperty();
	if (prop!=NULL)
	{
		prop->SetVisibility(!prop->GetVisibility());
		CSTree->RefreshItem(GetIndex(prop));
		if (prop->GetVisibility()) StructureVTK->SetPropOpacity(prop->GetUniqueID(),prop->GetFillColor().a);
		else StructureVTK->SetPropOpacity(prop->GetUniqueID(),0);
	}
}
示例#2
0
void QCSXCAD::ExportGeometry(QString dirname, int type)
{
	if (dirname.isEmpty())
		dirname = QFileDialog::getExistingDirectory(this, tr("Choose directory to save data"));
	if (dirname.isEmpty())
		return;
	int QtyProp = GetQtyProperties();
	for (int i=0;i<QtyProp;++i)
	{
		CSProperties* prop = GetProperty(i);
		if (prop==NULL) continue;

		 unsigned int uID = prop->GetUniqueID();

		 if (prop->GetVisibility()==true)
		 {
			QString filename(dirname);
			filename.append("/");
			filename.append(QString::fromUtf8(prop->GetName().c_str()));
			switch (type)
			{
			case 0:
				StructureVTK->ExportProperty2PolyDataVTK(uID,filename,clGrid.GetDeltaUnit());
				break;
			case 1:
				StructureVTK->ExportProperty2STL(uID,filename,clGrid.GetDeltaUnit());
				break;
			case 2:
				StructureVTK->ExportProperty2PLY(uID,filename,clGrid.GetDeltaUnit());
				break;
			default:
				QMessageBox::warning(this, "Export Dialog","Unkown export type, skipping...");
				return;
				break;
			}
		 }
	 }
}