mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
Integration of OCCT 6.5.0 from SVN
This commit is contained in:
2
samples/CSharp/shell/shell.cpp
Executable file
2
samples/CSharp/shell/shell.cpp
Executable file
@@ -0,0 +1,2 @@
|
||||
#include ".\shell.h"
|
||||
|
391
samples/CSharp/shell/shell.h
Executable file
391
samples/CSharp/shell/shell.h
Executable file
@@ -0,0 +1,391 @@
|
||||
#pragma once
|
||||
#using <mscorlib.dll>
|
||||
#include "OCCViewer.h"
|
||||
#include "StdAfx.h"
|
||||
|
||||
public ref class shell
|
||||
{
|
||||
|
||||
private:
|
||||
OCCViewer* myOCCViewer;
|
||||
public:
|
||||
|
||||
bool InitViewer(System::IntPtr wnd)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
return myOCCViewer->InitViewer(wnd.ToPointer());
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ImportBrep(System::String^ filename)
|
||||
{
|
||||
if (myOCCViewer == NULL)
|
||||
return false;
|
||||
int length = filename->Length;
|
||||
char * fname = new char[length+1];
|
||||
for(int i = 0; i<length; i++)
|
||||
fname[i] = (char)filename->ToCharArray()[i];
|
||||
|
||||
fname[length] = '\0';
|
||||
bool res = myOCCViewer->ImportBRep(fname);
|
||||
delete [] fname;
|
||||
return res;
|
||||
}
|
||||
|
||||
void RedrawView(void)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->RedrawView();
|
||||
}
|
||||
|
||||
void UpdateView(void)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->UpdateView();
|
||||
}
|
||||
|
||||
void SetDegenerateModeOn(void)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->SetDegenerateModeOn();
|
||||
}
|
||||
|
||||
void SetDegenerateModeOff(void)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->SetDegenerateModeOff();
|
||||
}
|
||||
|
||||
void WindowFitAll(int Xmin, int Ymin, int Xmax, int Ymax)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->WindowFitAll(Xmin, Ymin, Xmax, Ymax);
|
||||
}
|
||||
|
||||
void Place(int x, int y, float zoomFactor)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->Place(x, y, zoomFactor);
|
||||
}
|
||||
|
||||
void Zoom(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->Zoom(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
void Pan(int x, int y)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->Pan(x, y);
|
||||
}
|
||||
|
||||
void Rotation(int x, int y)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->Rotation(x, y);
|
||||
}
|
||||
|
||||
void StartRotation(int x, int y)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->StartRotation(x, y);
|
||||
}
|
||||
|
||||
void Select(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->Select(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
void Select(void)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->Select();
|
||||
}
|
||||
|
||||
void MoveTo(int x, int y)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->MoveTo(x, y);
|
||||
}
|
||||
|
||||
void ShiftSelect(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->ShiftSelect(x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
void ShiftSelect(void)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->ShiftSelect();
|
||||
}
|
||||
|
||||
int GetBGColR(void)
|
||||
{
|
||||
int r, b, g;
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->BackgroundColor(r,g,b);
|
||||
return r;
|
||||
}
|
||||
|
||||
int GetBGColG(void)
|
||||
{
|
||||
int r, b, g;
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->BackgroundColor(r,g,b);
|
||||
return g;
|
||||
}
|
||||
|
||||
int GetBGColB(void)
|
||||
{
|
||||
int r, b, g;
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->BackgroundColor(r,g,b);
|
||||
return b;
|
||||
}
|
||||
|
||||
void UpdateCurrentViewer(void)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->UpdateCurrentViewer();
|
||||
}
|
||||
|
||||
void FrontView(void)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->FrontView();
|
||||
}
|
||||
|
||||
void TopView(void)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->TopView();
|
||||
}
|
||||
|
||||
void LeftView(void)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->LeftView();
|
||||
}
|
||||
|
||||
void BackView(void)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->BackView();
|
||||
}
|
||||
|
||||
void RightView(void)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->RightView();
|
||||
}
|
||||
|
||||
void BottomView(void)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->BottomView();
|
||||
}
|
||||
|
||||
void AxoView(void)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->AxoView();
|
||||
}
|
||||
|
||||
float Scale(void)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
return myOCCViewer->Scale();
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ZoomAllView(void)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->ZoomAllView();
|
||||
}
|
||||
|
||||
void Reset(void)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->ResetView();
|
||||
}
|
||||
|
||||
void SetDisplayMode(int aMode)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->SetDisplayMode(aMode);
|
||||
}
|
||||
|
||||
void SetColor(int r, int g, int b)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->SetColor(r, g, b);
|
||||
}
|
||||
|
||||
int GetObjColR(void)
|
||||
{
|
||||
int r, g, b;
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->ObjectColor(r, g, b);
|
||||
return r;
|
||||
}
|
||||
|
||||
int GetObjColG(void)
|
||||
{
|
||||
int r, g, b;
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->ObjectColor(r, g, b);
|
||||
return g;
|
||||
}
|
||||
|
||||
int GetObjColB(void)
|
||||
{
|
||||
int r, g, b;
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->ObjectColor(r, g, b);
|
||||
return b;
|
||||
}
|
||||
|
||||
void SetBackgroundColor(int r, int g, int b)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->SetBackgroundColor(r, g, b);
|
||||
}
|
||||
|
||||
void EraseObjects(void)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->EraseObjects();
|
||||
}
|
||||
|
||||
float GetOCCVersion(void)
|
||||
{
|
||||
if (myOCCViewer == NULL)
|
||||
return 0.0;
|
||||
else
|
||||
return myOCCViewer->GetVersion();
|
||||
}
|
||||
|
||||
void SetMaterial(int theMaterial)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->SetMaterial(theMaterial);
|
||||
}
|
||||
|
||||
void SetTransparency(int TheTrans)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->SetTransparency(TheTrans);
|
||||
}
|
||||
|
||||
bool TranslateModel(System::String^ filename, int format, bool IsImport)
|
||||
{
|
||||
if (myOCCViewer == NULL)
|
||||
return false;
|
||||
int length = filename->Length;
|
||||
char * fname = new char[length+1];
|
||||
for(int i = 0; i<length; i++)
|
||||
fname[i] = (char)filename->ToCharArray()[i];
|
||||
|
||||
fname[length] = '\0';
|
||||
bool res;
|
||||
if (IsImport)
|
||||
{
|
||||
switch(format)
|
||||
{
|
||||
case 0:
|
||||
res=myOCCViewer->ImportBRep(fname);
|
||||
break;
|
||||
case 1:
|
||||
res=myOCCViewer->ImportCsfdb(fname);
|
||||
break;
|
||||
case 2:
|
||||
res=myOCCViewer->ImportStep(fname);
|
||||
break;
|
||||
case 3:
|
||||
res=myOCCViewer->ImportIges(fname);
|
||||
break;
|
||||
default:
|
||||
res=false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
switch(format)
|
||||
{
|
||||
case 0:
|
||||
res=myOCCViewer->ExportBRep(fname);
|
||||
break;
|
||||
case 2:
|
||||
res=myOCCViewer->ExpotStep(fname);
|
||||
break;
|
||||
case 3:
|
||||
res=myOCCViewer->ExportIges(fname);
|
||||
break;
|
||||
case 4:
|
||||
res=myOCCViewer->ExportVrml(fname);
|
||||
break;
|
||||
case 5:
|
||||
res=myOCCViewer->ExportStl(fname);
|
||||
break;
|
||||
case 6:
|
||||
res=myOCCViewer->Dump(fname);
|
||||
default:
|
||||
res=false;
|
||||
}
|
||||
}
|
||||
delete [] fname;
|
||||
return res;
|
||||
}
|
||||
|
||||
bool IsObjectSelected(void)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
return myOCCViewer->IsObjectSelected();
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
int DisplayMode(void)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
return myOCCViewer->DisplayMode();
|
||||
else return -1;
|
||||
}
|
||||
|
||||
void CreateNewView(System::IntPtr wnd)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
myOCCViewer->CreateNewView(wnd.ToPointer());
|
||||
}
|
||||
|
||||
bool SetAISContext(shell^ v)
|
||||
{
|
||||
if (myOCCViewer != NULL)
|
||||
return this->myOCCViewer->SetAISContext(v->GetOCCViewer());
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
OCCViewer* GetOCCViewer(void)
|
||||
{
|
||||
return myOCCViewer;
|
||||
}
|
||||
|
||||
void InitOCCViewer(void)
|
||||
{
|
||||
myOCCViewer = new OCCViewer();
|
||||
}
|
||||
|
||||
int CharToInt(System::String^ symbol)
|
||||
{
|
||||
if (myOCCViewer == NULL)
|
||||
return -1;
|
||||
char s = (char)symbol->ToCharArray()[0];
|
||||
return myOCCViewer->CharToInt(s);
|
||||
}
|
||||
};
|
215
samples/CSharp/shell/shell.vcproj
Executable file
215
samples/CSharp/shell/shell.vcproj
Executable file
@@ -0,0 +1,215 @@
|
||||
<?xml version="1.0" encoding="windows-1251"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="shell"
|
||||
ProjectGUID="{969912D9-78E7-4AB8-B4FF-6B52B4F03991}"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
ManagedExtensions="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\OCC\;$(CASROOT)\inc"
|
||||
PreprocessorDefinitions="WNT"
|
||||
MinimalRebuild="false"
|
||||
BasicRuntimeChecks="0"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="OCC.lib TKV3d.lib TKV2d.lib TKHLR.lib TKService.lib PTKernel.lib TKShapeSchema.lib TKBool.lib TKMath.lib TKBO.lib TKernel.lib TKPrim.lib TKTopAlgo.lib TKBRep.lib TKGeomAlgo.lib TKPShape.lib TKXSBase.lib TKIGES.lib TKSTEP.lib TKSTEP209.lib TKSTEPAttr.lib TKSTEPBase.lib TKShHealing.lib TKSTL.lib TKVRML.lib"
|
||||
OutputFile="$(OutDir)/shell.dll"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="..\OCC\$(OutDir);$(CASROOT)\win32\lib"
|
||||
GenerateDebugInformation="true"
|
||||
AssemblyDebug="1"
|
||||
ProgramDatabaseFile="$(OutDir)/shell.pdb"
|
||||
SubSystem="2"
|
||||
ImportLibrary="$(OutDir)/shell.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="2"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
ManagedExtensions="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\OCC\;$(CASROOT)\inc"
|
||||
PreprocessorDefinitions="WNT"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="OCC.lib TKV3d.lib TKV2d.lib TKHLR.lib TKService.lib PTKernel.lib TKShapeSchema.lib TKBool.lib TKMath.lib TKBO.lib TKernel.lib TKPrim.lib TKTopAlgo.lib TKBRep.lib TKGeomAlgo.lib TKPShape.lib TKXSBase.lib TKIGES.lib TKSTEP.lib TKSTEP209.lib TKSTEPAttr.lib TKSTEPBase.lib TKShHealing.lib TKSTL.lib TKVRML.lib"
|
||||
OutputFile="$(OutDir)/shell.dll"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="..\OCC\$(OutDir);$(CASROOT)\win32\vc8\lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
ImportLibrary="$(OutDir)/shell.lib"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\shell.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath=".\shell.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
Reference in New Issue
Block a user