本文整理汇总了C#中Canguro类的典型用法代码示例。如果您正苦于以下问题:C# Canguro类的具体用法?C# Canguro怎么用?C# Canguro使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Canguro类属于命名空间,在下文中一共展示了Canguro类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AnalysisOptionsDialog
public AnalysisOptionsDialog(Canguro.Controller.CommandServices services)
{
this.services = services;
InitializeComponent();
Init();
UpdateDialog();
}
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:7,代码来源:AnalysisOptionsDialog.cs
示例2: Run
/// <summary>
/// Executes the command.
/// Opens the Open File Dialog and Loads the selected tsm file.
/// Asks to save changes if needed.
/// </summary>
/// <param name="services">CommandServices object to interact with the system</param>
public override void Run(Canguro.Controller.CommandServices services)
{
if (services.Model.Modified)
{
DialogResult dr = MessageBox.Show(Culture.Get("askSaveChangesAndExit"), Application.ProductName, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
if (dr == DialogResult.Cancel)
return;
else if (dr == DialogResult.Yes)
services.Run(new SaveModelCmd());
}
string path = "";
System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
dlg.Filter = "Treu Structure Model (*.tsm)|*.tsm";
dlg.DefaultExt = "tsm";
dlg.AddExtension = true;
dlg.Title = Culture.Get("OpenFileTitle");
if (services.Model.CurrentPath.Length > 0)
dlg.FileName = services.Model.CurrentPath;
dlg.CheckPathExists = true;
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
path = dlg.FileName;
try
{
if (path.Length > 0)
{
services.Model.Load(path);
}
}
catch
{
MessageBox.Show(Culture.Get("errorLoadingFile") + " " + path, Culture.Get("error"),
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:40,代码来源:OpenModelCmd.cs
示例3: Run
/// <summary>
/// Executes the command.
/// Moves the joint according to a given scale factor and pivot point.
/// </summary>
/// <param name="services">CommandServices object to interact with the system</param>
public override void Run(Canguro.Controller.CommandServices services)
{
List<Canguro.Model.Joint> selection = new List<Canguro.Model.Joint>();
List<Item> selectedItems = services.GetSelection();
if (selectedItems.Count == 0)
return;
foreach (Item item in selectedItems)
{
if (item is Joint)
selection.Add((Joint)item);
else if (item is LineElement)
{
LineElement l = (LineElement)item;
if (!selection.Contains(l.I))
selection.Add(l.I);
if (!selection.Contains(l.J))
selection.Add(l.J);
}
}
Microsoft.DirectX.Vector3 piv;
float scale = services.GetSingle(Culture.Get("getScale"));
Controller.Snap.Magnet m = services.GetPoint(Culture.Get("pivotScalePoint"));
if (m == null) return;
piv = m.SnapPosition;
foreach (Canguro.Model.Joint j in selection)
{
j.X = (j.X - piv.X) * scale + piv.X;
j.Y = (j.Y - piv.Y) * scale + piv.Y;
j.Z = (j.Z - piv.Z) * scale + piv.Z;
}
}
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:40,代码来源:ScaleCmd.cs
示例4: Run
/// <summary>
/// Executes the command.
/// Creates a series of connected Line Elements given at least 2 points. Each subsequent point given adds a new Line Element.
/// </summary>
/// <param name="services">CommandServices object to interact with the system</param>
public override void Run(Canguro.Controller.CommandServices services)
{
LineElement line;
Joint joint1, joint2;
LineProps props = new StraightFrameProps();
List<LineElement> newLines = new List<LineElement>();
List<AreaElement> newAreas = new List<AreaElement>();
services.GetProperties(Culture.Get("addLineProps"), props);
joint1 = services.GetJoint(newLines);
services.TrackingService = LineTrackingService.Instance;
services.TrackingService.SetPoint(joint1.Position);
try
{
while ((joint2 = services.GetJoint(newLines)) != null)
{
if (joint2 != joint1)
{
services.Model.LineList.Add(line = new LineElement(props, joint1, joint2));
newLines.Add(line);
joint1 = joint2;
services.TrackingService.SetPoint(joint1.Position);
// Para que se refleje el cambio inmediatamente
services.Model.ChangeModel();
}
}
}
catch (Canguro.Controller.CancelCommandException) { }
if (newLines.Count == 0)
services.Model.Undo.Rollback();
else
JoinCmd.Join(services.Model, new List<Joint>(), newLines, newAreas);
}
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:40,代码来源:LineStripCmd.cs
示例5: Run
/// <summary>
/// Executes the command.
/// Sets the IsSelected property of all the Items in the Active Layer to true.
/// </summary>
/// <param name="services">CommandServices object to interact with the system</param>
public override void Run(Canguro.Controller.CommandServices services)
{
Layer layer = services.Model.ActiveLayer;
foreach (Item item in layer.Items)
item.IsSelected = true;
services.Model.ChangeSelection(null);
}
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:12,代码来源:SelectLayerCmd.cs
示例6: Run
/// <summary>
/// Executes the command.
/// Deletes the selected Items.
/// If none is selected, it requests a selection.
/// </summary>
/// <param name="services">CommandServices object to interact with the system</param>
public override void Run(Canguro.Controller.CommandServices services)
{
Canguro.Model.Model model = services.Model;
if (model.LoadCases.Count > 1)
{
Canguro.Model.Load.LoadCase oldCase = model.ActiveLoadCase;
// Remove associated AnalysisCase
// Find the corresponding AbstractCase
Canguro.Model.Load.AnalysisCase aCase = null;
foreach (Canguro.Model.Load.AbstractCase ac in services.Model.AbstractCases)
if (ac is Canguro.Model.Load.AnalysisCase && ac.Name.Equals(oldCase.Name))
{
aCase = (Canguro.Model.Load.AnalysisCase)ac;
break;
}
bool deleteLCase = true;
// Now remove the AnalysisCase
if (aCase != null)
deleteLCase = services.Model.AbstractCases.Remove(aCase);
if (deleteLCase)
{
services.Model.LoadCases.Remove(oldCase.Name);
services.Model.ChangeModel();
}
}
}
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:35,代码来源:DeleteLoadCaseCmd.cs
示例7: Run
/// <summary>
/// Executes the Non-Interactive Command.
/// Sets the RotationMatrix for the View with a Default 3D View and Executes ZoomAll.
/// </summary>
/// <param name="activeView">The Current Active View object</param>
public override void Run(Canguro.View.GraphicView activeView)
{
activeView.ArcBallCtrl.ResetRotation();
activeView.ArcBallCtrl.RotationMatrix = Matrix.RotationX(-(float)Math.PI / 2.0f) * Matrix.RotationY(-3.0f * (float)Math.PI / 4.0f) * Matrix.RotationX((float)Math.PI / 6.0f);
activeView.ViewMatrix = activeView.ArcBallCtrl.ViewMatrix;
ZoomAll.Instance.Run(activeView);
}
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:12,代码来源:PredefinedXYZ.cs
示例8: LineMagnet
public LineMagnet(Canguro.Model.LineElement line)
: base(line.I.Position)
{
this.direction = line.J.Position - line.I.Position;
this.type = LineMagnetType.FollowProjection;
this.line = line;
}
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:7,代码来源:LineMagnet.cs
示例9: Reset
public void Reset(Canguro.View.GraphicView activeView)
{
if (trackingService != null)
trackingService.Reset(activeView);
snapController.Reset(activeView);
hoverController.Reset(activeView);
}
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:7,代码来源:TrackingController.cs
示例10: Run
/// <summary>
/// Executes the command.
/// Gets the Load Case properties from the User, adds it to the Model and sets it as Active.
/// </summary>
/// <param name="services">CommandServices object to interact with the system</param>
public override void Run(Canguro.Controller.CommandServices services)
{
string name = Culture.Get("defaultLoadCase");
LoadCase lCase = new LoadCase(name, LoadCase.LoadCaseType.Dead);
lCase.Name = name;
// services.GetProperties(lCase.Name, lCase, false);
EditLoadCaseDialog dlg = new EditLoadCaseDialog(lCase);
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
if (!services.Model.LoadCases.ContainsKey(lCase.Name))
services.Model.LoadCases.Add(lCase.Name, lCase);
services.Model.ActiveLoadCase = lCase;
AnalysisCase aCase = new AnalysisCase(lCase.Name);
StaticCaseProps props = aCase.Properties as StaticCaseProps;
if (props != null)
{
List<StaticCaseFactor> list = props.Loads;
list.Add(new StaticCaseFactor(lCase));
props.Loads = list;
services.Model.AbstractCases.Add(aCase);
}
}
else
services.Model.Undo.Rollback();
}
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:32,代码来源:AddLoadCaseCmd.cs
示例11: Run
public override void Run(Canguro.Controller.CommandServices services)
{
services.StoreSelection();
LineElement line = services.GetLine();
List<LinkedList<LineElement>> graph = GetLineGraph(services.Model);
ItemList<Joint> joints = services.Model.JointList;
int numJoints = joints.Count;
bool[] colors = new bool[numJoints];
Stack<LineElement> stack = new Stack<LineElement>();
stack.Push(line);
while (stack.Count > 0)
{
line = stack.Pop();
line.IsSelected = true;
if (!colors[line.I.Id])
{
line.I.IsSelected = true;
visit(graph, (int)line.I.Id, stack, line);
colors[line.I.Id] = true;
}
if (!colors[line.J.Id])
{
line.J.IsSelected = true;
visit(graph, (int)line.J.Id, stack, line);
colors[line.J.Id] = true;
}
}
services.RestoreSelection();
services.Model.ChangeSelection(null);
}
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:33,代码来源:SelectLineCmd.cs
示例12: Run
/// <summary>
/// Executes the command.
/// Deletes all Items in a Layer
/// </summary>
/// <param name="services">CommandServices object to interact with the system</param>
public override void Run(Canguro.Controller.CommandServices services)
{
int count = 0;
foreach (Layer layer in services.Model.Layers)
if (layer != null)
count++;
services.Model.UnSelectAll();
if (services.Model.ActiveLayer.Items.Count > 0)
System.Windows.Forms.MessageBox.Show(Culture.Get("layerHasObjectsError"), Culture.Get("error"), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
else if (count <= 1)
System.Windows.Forms.MessageBox.Show(Culture.Get("lastLayerError"), Culture.Get("error"), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
else
{
Layer deletedLayer = services.Model.ActiveLayer;
foreach (Layer active in services.Model.Layers)
if (active != null && active != deletedLayer)
{
services.Model.ActiveLayer = active;
break;
}
Layer activeLayer = services.Model.ActiveLayer;
foreach (Item item in services.Model.LineList)
if (item != null && item.IsSelected)
item.Layer = activeLayer;
foreach (Item item in services.Model.JointList)
if (item != null && item.IsSelected)
item.Layer = activeLayer;
services.Model.Layers.Remove(deletedLayer);
}
}
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:39,代码来源:DeleteLayer.cs
示例13: RecalcPrimaryDependant
public void RecalcPrimaryDependant(Canguro.View.GraphicView activeView, PointMagnet primaryPoint, LineMagnet[] globalAxes)
{
if (primaryPoint != null)
{
// Move area to lay on the primaryPoint and to set its direction any canonic
// plane (X=x, Y=y or Z=z) which is the most paralell to the screen plane
position = primaryPoint.Position;
// Get screen plane normal
Vector3 s0 = screenNormal[0], s1 = screenNormal[1], sNormal;
activeView.Unproject(ref s0);
activeView.Unproject(ref s1);
sNormal = s0 - s1;
// Assign the area normal to the most paralell canonical plane
// (giving priority to the Z plane)
int maxCosIndex = 2;
float cosX, cosY, cosZ;
cosX = Vector3.Dot(sNormal, globalAxes[0].Direction);
cosY = Vector3.Dot(sNormal, globalAxes[1].Direction);
cosZ = Vector3.Dot(sNormal, globalAxes[2].Direction);
if (Math.Abs(cosZ) < minZPlaneAngle)
maxCosIndex = (cosX >= cosY) ? ((cosX > cosZ) ? 0 : 2) : ((cosY > cosZ) ? 1 : 2);
normal = globalAxes[maxCosIndex].Direction;
}
else
{
position = Vector3.Empty;
normal = globalAxes[2].Direction;
}
}
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:33,代码来源:AreaMagnet.cs
示例14: Run
/// <summary>
/// Executes the command.
/// Opens the Sections Dialog
/// </summary>
/// <param name="services">CommandServices object to interact with the system</param>
public override void Run(Canguro.Controller.CommandServices services)
{
SectionsGUI gui = new SectionsGUI();
if (services.ShowDialog(gui) == System.Windows.Forms.DialogResult.Cancel)
throw new Canguro.Controller.CancelCommandException();
services.Model.ChangeModel(true);
}
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:13,代码来源:SectionsCmd.cs
示例15: ButtonDown
public override void ButtonDown(Canguro.View.GraphicView activeView, System.Windows.Forms.MouseEventArgs e)
{
gv = activeView;
oldM = gv.ViewMatrix;
firstY = e.Y;
gv.ArcBallCtrl.OnBeginZoom(e);
}
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:8,代码来源:ZoomInteractive.cs
示例16: Reset
public void Reset(Canguro.Model.Model model)
{
maxStress = 0f;
minStress = 0f;
largest = 0f;
if (recalculateMinMaxStressesOfSelection(model))
largest = Math.Max(Math.Abs(maxStress), Math.Abs(minStress));
}
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:9,代码来源:StressRenderHelper.cs
示例17: Export
/// <summary>
/// Create a temporary MDB file that will be send to SAP application
/// </summary>
/// <param name="m"></param>
/// <param name="filePath"></param>
internal void Export(Canguro.Model.Model m, string filePath)
{
OleDbConnection cn = null;
Canguro.Model.UnitSystem.UnitSystem uSystem = m.UnitSystem;
try
{
File.Copy(System.Windows.Forms.Application.StartupPath + "\\RuntimeData\\modelTransfer", filePath /*"tmp"*/, true);
//Use a string variable to hold the ConnectionString.
string connectString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath;
//Create an OleDbConnection object,
//and then pass in the ConnectionString to the constructor.
cn = new OleDbConnection(connectString);
cn.Open();
m.UnitSystem = Canguro.Model.UnitSystem.InternationalSystem.Instance;
// Create store procedures for joint items
store(cn, m.JointList);
// Create store procedures for line itemes
store(cn, m.LineList);
// Create store procedures for materials
foreach (Material mat in MaterialManager.Instance.Materials.AsReadOnly())
if (mat != null)
store(cn, mat);
// Create store procedures for abstract case
foreach (AbstractCase aCase in m.AbstractCases)
if (aCase != null)
store(cn, aCase, m);
// Create store procedures for load cases
foreach (LoadCase lCase in m.LoadCases.Values)
if (lCase != null)
store(cn, lCase);
// Create store procedures for concrete material
store(cn, m.ConcreteDesignOptions);
// Create store procedures for steel materia
store(cn, m.SteelDesignOptions);
// Create store procedures for frame design
storeFrameDesignProcedures(cn, m);
// Create store procedures for spectrum analysis
store(cn, m.ResponseSpectra, m.AbstractCases);
}
catch
{
System.Windows.Forms.MessageBox.Show(Culture.Get("ErrorExporting"), Culture.Get("error"),
System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
throw;
}
finally
{
if (cn != null)
cn.Close();
m.UnitSystem = uSystem;
}
}
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:61,代码来源:ExportMDBCmd.cs
示例18: Run
/// <summary>
/// Executes the command.
/// Sets the Layer property of all the selected Items to point to the Active Layer
/// </summary>
/// <param name="services">CommandServices object to interact with the system</param>
public override void Run(Canguro.Controller.CommandServices services)
{
Layer layer = services.Model.ActiveLayer;
foreach (Item item in services.Model.JointList)
if (item != null && item.IsSelected)
item.Layer = layer;
foreach (Item item in services.Model.LineList)
if (item != null && item.IsSelected)
item.Layer = layer;
}
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:15,代码来源:MoveToLayerCmd.cs
示例19: Run
/// <summary>
/// Executes the Non-Interactive Command.
/// Sets the InternalForcesShown property of RenderOptions to Mz
/// </summary>
/// <param name="activeView">The Current Active View object</param>
public override void Run(Canguro.View.GraphicView activeView)
{
Canguro.View.Renderer.ModelRenderer mr = activeView.ModelRenderer;
if (mr != null && mr.ForcesRenderer != null)
{
if (mr.RenderOptions.InternalForcesShown == Canguro.View.Renderer.RenderOptions.InternalForces.Mz)
mr.RenderOptions.InternalForcesShown = Canguro.View.Renderer.RenderOptions.InternalForces.None;
else
mr.RenderOptions.InternalForcesShown = Canguro.View.Renderer.RenderOptions.InternalForces.Mz;
}
}
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:16,代码来源:RenderM3.cs
示例20: Run
/// <summary>
/// Executes the command.
/// Execute CopyCmd and PasteCmd until cancelled.
/// </summary>
/// <param name="services">CommandServices object to interact with the system</param>
public override void Run(Canguro.Controller.CommandServices services)
{
services.Run(new CopyCmd());
PasteCmd cmd;
do
{
services.Run(cmd = new PasteCmd());
services.Model.ChangeModel();
}
while (cmd.ObjectCount > 0);
}
开发者ID:rforsbach,项目名称:Treu-Structure,代码行数:16,代码来源:CopyPasteCmd.cs
注:本文中的Canguro类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论