本文整理汇总了C#中MainWindow.AddModelGroup方法的典型用法代码示例。如果您正苦于以下问题:C# MainWindow.AddModelGroup方法的具体用法?C# MainWindow.AddModelGroup怎么用?C# MainWindow.AddModelGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWindow
的用法示例。
在下文中一共展示了MainWindow.AddModelGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
public void Render(MainWindow mw, string fileName, SortedList<string, Color> allowed2D, SortedList<string, Color> allowed3D)
{
// Create modelgroups for each sort of model
SortedList<string, Model3DGroup> models2D = new SortedList<string,Model3DGroup>();
SortedList<string, Model3DGroup> models3D = new SortedList<string,Model3DGroup>();
// Parse our file
OsmImporter oi = new OsmImporter();
oi.OsmParse(fileName);
// Get the parsed content
double[] bounds = oi.bounds;
List<Way> ways = oi.ways;
// Calculate the xmin, xmax, ymin and ymax values
double[] xymin, xymax;
xymin = wm.Project(bounds[0], bounds[1]);
xymax = wm.Project(bounds[2], bounds[3]);
// Calculate a centralized point to pick as reference origin
xcen = xymin[0] + (xymax[0] - xymin[0]) / 2;
ycen = xymin[1] + (xymax[1] - xymin[1]) / 2;
// Loop through all the ways
foreach (Way w in ways) {
bool was2D = false;
bool was3D = false;
// Is this a 2D way? (field, road, ...)
foreach (KeyValuePair<string, Color> kvp in allowed2D) {
foreach (Tag t in w.Tags) {
if (t.Key == kvp.Key) {
Model3DGroup m3dg;
if (models2D.TryGetValue(kvp.Key, out m3dg)) {
m3dg.Children.Add(Create2D(w, kvp.Value));
} else {
m3dg = new Model3DGroup();
m3dg.Children.Add(Create2D(w, kvp.Value));
//mw.AddModelGroup(m3dg);
models2D.Add(kvp.Key, m3dg);
}
was2D = true;
}
if (was2D) break;
}
if (was2D) break;
}
if (was2D) continue;
// Is this a 3D way? (building, ...)
foreach (KeyValuePair<string, Color> kvp in allowed3D) {
foreach (Tag t in w.Tags) {
if (t.Key == kvp.Key) {
Model3DGroup m3dg;
if (models3D.TryGetValue(kvp.Key, out m3dg)) {
m3dg.Children.Add(Create3D(w, kvp.Value));
} else {
m3dg = new Model3DGroup();
m3dg.Children.Add(Create3D(w, kvp.Value));
//mw.AddModelGroup(m3dg);
models3D.Add(kvp.Key, m3dg);
}
was3D = true;
}
if (was3D) break;
}
if (was3D) break;
}
}
foreach (KeyValuePair<string, Model3DGroup> kvp in models2D) {
mw.AddModelGroup(kvp.Value);
}
foreach (KeyValuePair<string, Model3DGroup> kvp in models3D) {
mw.AddModelGroup(kvp.Value);
}
}