added Revit 2022 SDK minus except *rvt and *rfa

This commit is contained in:
Jeremy Tammik
2021-04-20 11:36:21 +02:00
parent 1133a82dc5
commit 7e327986e8
3034 changed files with 1245318 additions and 0 deletions
@@ -0,0 +1,92 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
namespace Revit.SDK.Samples.SharedCoordinateSystem.CS
{
/// <summary>
/// Implements the Revit add-in interface IExternalCommand
/// </summary>
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
[Autodesk.Revit.Attributes.Journaling(Autodesk.Revit.Attributes.JournalingMode.NoCommandData)]
public class Command : IExternalCommand
{
#region IExternalCommand Members Implementation
/// <summary>
/// Implement this method as an external command for Revit.
/// </summary>
/// <param name="commandData">An object that is passed to the external application
/// which contains data related to the command,
/// such as the application object and active view.</param>
/// <param name="message">A message that can be set by the external application
/// which will be displayed if a failure or cancellation is returned by
/// the external command.</param>
/// <param name="elements">A set of elements to which the external application
/// can add elements that are to be highlighted in case of failure or cancellation.</param>
/// <returns>Return the status of the external command.
/// A result of Succeeded means that the API external method functioned as expected.
/// Cancelled can be used to signify that the user cancelled the external operation
/// at some point. Failure should be returned if the application is unable to proceed with
/// the operation.</returns>
public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData,
ref string message, Autodesk.Revit.DB.ElementSet elements)
{
try
{
Transaction trans = new Transaction(commandData.Application.ActiveUIDocument.Document, "Revit.SDK.Samples.SharedCoordinateSystem");
trans.Start();
CoordinateSystemData Data = new CoordinateSystemData(commandData);
Data.GatData();
using (CoordinateSystemDataForm displayForm =
new CoordinateSystemDataForm(Data, commandData.Application.Application.Cities,
commandData.Application.ActiveUIDocument.Document.SiteLocation))
{
if (DialogResult.OK != displayForm.ShowDialog())
{
trans.RollBack();
return Autodesk.Revit.UI.Result.Cancelled;
}
}
trans.Commit();
return Autodesk.Revit.UI.Result.Succeeded;
}
catch (Exception ex)
{
message = ex.Message;
return Autodesk.Revit.UI.Result.Failed;
}
}
#endregion IExternalCommand Members Implementation
}
}
@@ -0,0 +1,276 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace Revit.SDK.Samples.SharedCoordinateSystem.CS
{
/// <summary>
/// this class is used to get, set and manage information about Location
/// </summary>
public class CoordinateSystemData
{
ExternalCommandData m_command; // the ExternalCommandData reference
Autodesk.Revit.UI.UIApplication m_application; //the revit application reference
const double Modulus = 0.0174532925199433; //a modulus for degree convert to pi
const int Precision = 3; //default precision
string m_currentLocationName; //the location of the active project;
List<string> m_locationnames = new List<string>(); //a list to store all the location name
double m_angle; //Angle from True North
double m_eastWest; //East to West offset
double m_northSouth; //North to South offset
double m_elevation; //Elevation above ground level
/// <summary>
/// the value of the angle form true north
/// </summary>
public double AngleOffset
{
get
{
return m_angle;
}
}
/// <summary>
/// return the East to West offset
/// </summary>
public double EastWestOffset
{
get
{
return m_eastWest;
}
}
/// <summary>
/// return the North to South offset
/// </summary>
public double NorthSouthOffset
{
get
{
return m_northSouth;
}
}
/// <summary>
/// return the Elevation above ground level
/// </summary>
public double PositionElevation
{
get
{
return m_elevation;
}
}
/// <summary>
/// get and set the current project location name of the project
/// </summary>
public string LocationName
{
get
{
return m_currentLocationName;
}
set
{
m_currentLocationName = value;
}
}
/// <summary>
/// get all the project locations' name of the project
/// </summary>
public List<string> LocationNames
{
get
{
return m_locationnames;
}
}
/// <summary>
/// constructor
/// </summary>
/// <param name="commandData">the ExternalCommandData reference</param>
public CoordinateSystemData(ExternalCommandData commandData)
{
m_command = commandData;
m_application = m_command.Application;
}
/// <summary>
/// get the shared coordinate system data of the project
/// </summary>
public void GatData()
{
this.GetLocationData();
}
/// <summary>
/// get the information of all the project locations associated with this project
/// </summary>
public void GetLocationData()
{
m_locationnames.Clear();
ProjectLocation currentLocation = m_application.ActiveUIDocument.Document.ActiveProjectLocation;
//get the current location name
m_currentLocationName = currentLocation.Name;
//Retrieve all the project locations associated with this project
ProjectLocationSet locations = m_application.ActiveUIDocument.Document.ProjectLocations;
ProjectLocationSetIterator iter = locations.ForwardIterator();
iter.Reset();
while (iter.MoveNext())
{
ProjectLocation locationTransform = iter.Current as ProjectLocation;
string transformName = locationTransform.Name;
m_locationnames.Add(transformName); //add the location's name to the list
}
}
/// <summary>
/// duplicate a new project location
/// </summary>
/// <param name="locationName">old location name</param>
/// <param name="newLocationName">new location name</param>
public void DuplicateLocation(string locationName, string newLocationName)
{
ProjectLocationSet locationSet = m_application.ActiveUIDocument.Document.ProjectLocations;
foreach (ProjectLocation projectLocation in locationSet)
{
if (projectLocation.Name == locationName ||
projectLocation.Name + " (current)" == locationName)
{
//duplicate a new project location
projectLocation.Duplicate(newLocationName);
break;
}
}
}
/// <summary>
/// change the current project location
/// </summary>
/// <param name="locationName"></param>
public void ChangeCurrentLocation(string locationName)
{
ProjectLocationSet locations = m_application.ActiveUIDocument.Document.ProjectLocations;
foreach (ProjectLocation projectLocation in locations)
{
//find the project location which is selected by user and
//set it to the current projecte location
if (projectLocation.Name == locationName)
{
m_application.ActiveUIDocument.Document.ActiveProjectLocation = projectLocation;
m_currentLocationName = locationName;
break;
}
}
}
/// <summary>
/// get the offset values of the project position
/// </summary>
/// <param name="locationName"></param>
public void GetOffset(string locationName)
{
ProjectLocationSet locationSet = m_application.ActiveUIDocument.Document.ProjectLocations;
foreach (ProjectLocation projectLocation in locationSet)
{
if (projectLocation.Name == locationName ||
projectLocation.Name + " (current)" == locationName)
{
Autodesk.Revit.DB.XYZ origin = new Autodesk.Revit.DB.XYZ (0, 0, 0);
//get the project position
ProjectPosition pp = projectLocation.GetProjectPosition(origin);
m_angle = (pp.Angle /= Modulus); //convert to unit degree
m_eastWest = pp.EastWest; //East to West offset
m_northSouth = pp.NorthSouth; //north to south offset
m_elevation = pp.Elevation; //Elevation above ground level
break;
}
}
this.ChangePrecision();
}
/// <summary>
/// change the offset value for the project position
/// </summary>
/// <param name="locationName">location name</param>
/// <param name="newAngle">angle from true north</param>
/// <param name="newEast">East to West offset</param>
/// <param name="newNorth">north to south offset</param>
/// <param name="newElevation">Elevation above ground level</param>
public void EditPosition(string locationName, double newAngle, double newEast,
double newNorth, double newElevation)
{
ProjectLocationSet locationSet = m_application.ActiveUIDocument.Document.ProjectLocations;
foreach (ProjectLocation location in locationSet)
{
if (location.Name == locationName ||
location.Name + " (current)" == locationName)
{
//get the project position
Autodesk.Revit.DB.XYZ origin = new Autodesk.Revit.DB.XYZ (0, 0, 0);
ProjectPosition projectPosition = location.GetProjectPosition(origin);
//change the offset value of the project position
projectPosition.Angle = newAngle * Modulus; //convert the unit
projectPosition.EastWest = newEast;
projectPosition.NorthSouth = newNorth;
projectPosition.Elevation = newElevation;
//set the value of the project position
location.SetProjectPosition(origin, projectPosition);
}
}
}
/// <summary>
/// change the Precision of the value
/// </summary>
private void ChangePrecision()
{
m_angle = UnitConversion.DealPrecision(m_angle, Precision);
m_eastWest = UnitConversion.DealPrecision(m_eastWest, Precision);
m_northSouth = UnitConversion.DealPrecision(m_northSouth, Precision);
m_elevation = UnitConversion.DealPrecision(m_elevation, Precision);
}
}
}
@@ -0,0 +1,417 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
namespace Revit.SDK.Samples.SharedCoordinateSystem.CS
{
/// <summary>
/// coordinate system data form
/// </summary>
partial class CoordinateSystemDataForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.coordinateSystemTabControl = new System.Windows.Forms.TabControl();
this.locationTabPage = new System.Windows.Forms.TabPage();
this.introduceLabel = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.eatWestTextBox = new System.Windows.Forms.TextBox();
this.northSouthTextBox = new System.Windows.Forms.TextBox();
this.elevationTextBox = new System.Windows.Forms.TextBox();
this.angleTextBox = new System.Windows.Forms.TextBox();
this.makeCurrentButton = new System.Windows.Forms.Button();
this.duplicateButton = new System.Windows.Forms.Button();
this.listlabel = new System.Windows.Forms.Label();
this.locationListBox = new System.Windows.Forms.ListBox();
this.placeTabPage = new System.Windows.Forms.TabPage();
this.timeZoneComboBox = new System.Windows.Forms.ComboBox();
this.longitudeTextBox = new System.Windows.Forms.TextBox();
this.latitudeTextBox = new System.Windows.Forms.TextBox();
this.cityNameComboBox = new System.Windows.Forms.ComboBox();
this.timeZoneLabel = new System.Windows.Forms.Label();
this.longitudeLabel = new System.Windows.Forms.Label();
this.latitudeLabel = new System.Windows.Forms.Label();
this.cityNameLabel = new System.Windows.Forms.Label();
this.siteIntroduceLabel = new System.Windows.Forms.Label();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.coordinateSystemTabControl.SuspendLayout();
this.locationTabPage.SuspendLayout();
this.placeTabPage.SuspendLayout();
this.SuspendLayout();
//
// coordinateSystemTabControl
//
this.coordinateSystemTabControl.Controls.Add(this.locationTabPage);
this.coordinateSystemTabControl.Controls.Add(this.placeTabPage);
this.coordinateSystemTabControl.Location = new System.Drawing.Point(5, 12);
this.coordinateSystemTabControl.Name = "coordinateSystemTabControl";
this.coordinateSystemTabControl.SelectedIndex = 0;
this.coordinateSystemTabControl.Size = new System.Drawing.Size(458, 307);
this.coordinateSystemTabControl.TabIndex = 0;
//
// locationTabPage
//
this.locationTabPage.Controls.Add(this.introduceLabel);
this.locationTabPage.Controls.Add(this.label4);
this.locationTabPage.Controls.Add(this.label3);
this.locationTabPage.Controls.Add(this.label2);
this.locationTabPage.Controls.Add(this.label1);
this.locationTabPage.Controls.Add(this.eatWestTextBox);
this.locationTabPage.Controls.Add(this.northSouthTextBox);
this.locationTabPage.Controls.Add(this.elevationTextBox);
this.locationTabPage.Controls.Add(this.angleTextBox);
this.locationTabPage.Controls.Add(this.makeCurrentButton);
this.locationTabPage.Controls.Add(this.duplicateButton);
this.locationTabPage.Controls.Add(this.listlabel);
this.locationTabPage.Controls.Add(this.locationListBox);
this.locationTabPage.Location = new System.Drawing.Point(4, 22);
this.locationTabPage.Name = "locationTabPage";
this.locationTabPage.Padding = new System.Windows.Forms.Padding(3);
this.locationTabPage.Size = new System.Drawing.Size(450, 281);
this.locationTabPage.TabIndex = 0;
this.locationTabPage.Text = "Locations";
this.locationTabPage.UseVisualStyleBackColor = true;
//
// introduceLabel
//
this.introduceLabel.AutoSize = true;
this.introduceLabel.Location = new System.Drawing.Point(7, 14);
this.introduceLabel.Name = "introduceLabel";
this.introduceLabel.Size = new System.Drawing.Size(387, 26);
this.introduceLabel.TabIndex = 1;
this.introduceLabel.Text = "Used for orientation and position of the project on the site and in relation to o" +
"ther \r\nbuildings. There may be many Shared Locations defined in one project.\r\n";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(205, 256);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(158, 13);
this.label4.TabIndex = 11;
this.label4.Text = "Elevation Above Ground Level :";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(205, 230);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(120, 13);
this.label3.TabIndex = 10;
this.label3.Text = "Angle From True North :";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(7, 256);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(113, 13);
this.label2.TabIndex = 7;
this.label2.Text = "North to South Offset :";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(7, 230);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(105, 13);
this.label1.TabIndex = 6;
this.label1.Text = "East to West Offset :";
//
// eatWestTextBox
//
this.eatWestTextBox.Location = new System.Drawing.Point(126, 227);
this.eatWestTextBox.Name = "eatWestTextBox";
this.eatWestTextBox.Size = new System.Drawing.Size(72, 20);
this.eatWestTextBox.TabIndex = 8;
//
// northSouthTextBox
//
this.northSouthTextBox.Location = new System.Drawing.Point(126, 253);
this.northSouthTextBox.Name = "northSouthTextBox";
this.northSouthTextBox.Size = new System.Drawing.Size(72, 20);
this.northSouthTextBox.TabIndex = 9;
//
// elevationTextBox
//
this.elevationTextBox.Location = new System.Drawing.Point(369, 253);
this.elevationTextBox.Name = "elevationTextBox";
this.elevationTextBox.Size = new System.Drawing.Size(72, 20);
this.elevationTextBox.TabIndex = 13;
//
// angleTextBox
//
this.angleTextBox.Location = new System.Drawing.Point(369, 227);
this.angleTextBox.Name = "angleTextBox";
this.angleTextBox.Size = new System.Drawing.Size(72, 20);
this.angleTextBox.TabIndex = 12;
this.angleTextBox.Leave += new System.EventHandler(this.angleTextBox_Leave);
//
// makeCurrentButton
//
this.makeCurrentButton.Location = new System.Drawing.Point(313, 118);
this.makeCurrentButton.Name = "makeCurrentButton";
this.makeCurrentButton.Size = new System.Drawing.Size(128, 23);
this.makeCurrentButton.TabIndex = 5;
this.makeCurrentButton.Text = "&Make Current";
this.makeCurrentButton.UseVisualStyleBackColor = true;
this.makeCurrentButton.Click += new System.EventHandler(this.makeCurrentButton_Click);
//
// duplicateButton
//
this.duplicateButton.Location = new System.Drawing.Point(313, 89);
this.duplicateButton.Name = "duplicateButton";
this.duplicateButton.Size = new System.Drawing.Size(128, 23);
this.duplicateButton.TabIndex = 4;
this.duplicateButton.Text = "&Duplicate...";
this.duplicateButton.UseVisualStyleBackColor = true;
this.duplicateButton.Click += new System.EventHandler(this.duplicateButton_Click);
//
// listlabel
//
this.listlabel.AutoSize = true;
this.listlabel.Location = new System.Drawing.Point(6, 69);
this.listlabel.Name = "listlabel";
this.listlabel.Size = new System.Drawing.Size(168, 13);
this.listlabel.TabIndex = 2;
this.listlabel.Text = "Locations definded in this project :";
//
// locationListBox
//
this.locationListBox.FormattingEnabled = true;
this.locationListBox.Location = new System.Drawing.Point(9, 89);
this.locationListBox.Name = "locationListBox";
this.locationListBox.Size = new System.Drawing.Size(298, 121);
this.locationListBox.Sorted = true;
this.locationListBox.TabIndex = 3;
this.locationListBox.SelectedIndexChanged += new System.EventHandler(this.locationListBox_SelectedIndexChanged);
//
// placeTabPage
//
this.placeTabPage.Controls.Add(this.timeZoneComboBox);
this.placeTabPage.Controls.Add(this.longitudeTextBox);
this.placeTabPage.Controls.Add(this.latitudeTextBox);
this.placeTabPage.Controls.Add(this.cityNameComboBox);
this.placeTabPage.Controls.Add(this.timeZoneLabel);
this.placeTabPage.Controls.Add(this.longitudeLabel);
this.placeTabPage.Controls.Add(this.latitudeLabel);
this.placeTabPage.Controls.Add(this.cityNameLabel);
this.placeTabPage.Controls.Add(this.siteIntroduceLabel);
this.placeTabPage.Location = new System.Drawing.Point(4, 22);
this.placeTabPage.Name = "placeTabPage";
this.placeTabPage.Padding = new System.Windows.Forms.Padding(3);
this.placeTabPage.Size = new System.Drawing.Size(450, 281);
this.placeTabPage.TabIndex = 1;
this.placeTabPage.Text = "Place";
this.placeTabPage.UseVisualStyleBackColor = true;
//
// timeZoneComboBox
//
this.timeZoneComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.timeZoneComboBox.FormattingEnabled = true;
this.timeZoneComboBox.Location = new System.Drawing.Point(136, 166);
this.timeZoneComboBox.Name = "timeZoneComboBox";
this.timeZoneComboBox.Size = new System.Drawing.Size(200, 21);
this.timeZoneComboBox.TabIndex = 8;
this.timeZoneComboBox.SelectedValueChanged += new System.EventHandler(this.timeZoneComboBox_SelectedValueChanged);
//
// longitudeTextBox
//
this.longitudeTextBox.Location = new System.Drawing.Point(136, 138);
this.longitudeTextBox.Name = "longitudeTextBox";
this.longitudeTextBox.Size = new System.Drawing.Size(200, 20);
this.longitudeTextBox.TabIndex = 7;
this.longitudeTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.longitudeTextBox.Leave += new System.EventHandler(this.longitudeTextBox_Leave);
this.longitudeTextBox.TextChanged += new System.EventHandler(this.longitudeTextBox_TextChanged);
//
// latitudeTextBox
//
this.latitudeTextBox.Location = new System.Drawing.Point(136, 111);
this.latitudeTextBox.Name = "latitudeTextBox";
this.latitudeTextBox.Size = new System.Drawing.Size(200, 20);
this.latitudeTextBox.TabIndex = 6;
this.latitudeTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.latitudeTextBox.Leave += new System.EventHandler(this.latitudeTextBox_Leave);
this.latitudeTextBox.TextChanged += new System.EventHandler(this.latitudeTextBox_TextChanged);
//
// cityNameComboBox
//
this.cityNameComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cityNameComboBox.FormattingEnabled = true;
this.cityNameComboBox.Location = new System.Drawing.Point(136, 83);
this.cityNameComboBox.Name = "cityNameComboBox";
this.cityNameComboBox.Size = new System.Drawing.Size(200, 21);
this.cityNameComboBox.TabIndex = 5;
this.cityNameComboBox.SelectedValueChanged += new System.EventHandler(this.cityNameComboBox_SelectedValueChanged);
//
// timeZoneLabel
//
this.timeZoneLabel.AutoSize = true;
this.timeZoneLabel.Location = new System.Drawing.Point(15, 169);
this.timeZoneLabel.Name = "timeZoneLabel";
this.timeZoneLabel.Size = new System.Drawing.Size(64, 13);
this.timeZoneLabel.TabIndex = 4;
this.timeZoneLabel.Text = "Time Zone :";
//
// longitudeLabel
//
this.longitudeLabel.AutoSize = true;
this.longitudeLabel.Location = new System.Drawing.Point(15, 141);
this.longitudeLabel.Name = "longitudeLabel";
this.longitudeLabel.Size = new System.Drawing.Size(60, 13);
this.longitudeLabel.TabIndex = 3;
this.longitudeLabel.Text = "Longitude :";
//
// latitudeLabel
//
this.latitudeLabel.AutoSize = true;
this.latitudeLabel.Location = new System.Drawing.Point(15, 114);
this.latitudeLabel.Name = "latitudeLabel";
this.latitudeLabel.Size = new System.Drawing.Size(51, 13);
this.latitudeLabel.TabIndex = 2;
this.latitudeLabel.Text = "Latitude :";
//
// cityNameLabel
//
this.cityNameLabel.AutoSize = true;
this.cityNameLabel.Location = new System.Drawing.Point(15, 86);
this.cityNameLabel.Name = "cityNameLabel";
this.cityNameLabel.Size = new System.Drawing.Size(30, 13);
this.cityNameLabel.TabIndex = 1;
this.cityNameLabel.Text = "City :";
//
// siteIntroduceLabel
//
this.siteIntroduceLabel.AutoSize = true;
this.siteIntroduceLabel.Location = new System.Drawing.Point(15, 22);
this.siteIntroduceLabel.Name = "siteIntroduceLabel";
this.siteIntroduceLabel.Size = new System.Drawing.Size(410, 26);
this.siteIntroduceLabel.TabIndex = 0;
this.siteIntroduceLabel.Text = "There is a single Place for each Revit project that defines where the project is " +
"placed \r\nin the world.";
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(277, 325);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(90, 25);
this.okButton.TabIndex = 14;
this.okButton.Text = "&OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(373, 325);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(90, 25);
this.cancelButton.TabIndex = 15;
this.cancelButton.Text = "&Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
//
// CoordinateSystemDataForm
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(470, 361);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.coordinateSystemTabControl);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "CoordinateSystemDataForm";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Manage Locations and Place";
this.Load += new System.EventHandler(this.CoordinateSystemDataForm_Load);
this.coordinateSystemTabControl.ResumeLayout(false);
this.locationTabPage.ResumeLayout(false);
this.locationTabPage.PerformLayout();
this.placeTabPage.ResumeLayout(false);
this.placeTabPage.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TabControl coordinateSystemTabControl;
private System.Windows.Forms.TabPage locationTabPage;
private System.Windows.Forms.TabPage placeTabPage;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
private System.Windows.Forms.ListBox locationListBox;
private System.Windows.Forms.Label listlabel;
private System.Windows.Forms.Button makeCurrentButton;
private System.Windows.Forms.Button duplicateButton;
private System.Windows.Forms.TextBox eatWestTextBox;
private System.Windows.Forms.TextBox northSouthTextBox;
private System.Windows.Forms.TextBox elevationTextBox;
private System.Windows.Forms.TextBox angleTextBox;
private System.Windows.Forms.Label introduceLabel;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label timeZoneLabel;
private System.Windows.Forms.Label longitudeLabel;
private System.Windows.Forms.Label latitudeLabel;
private System.Windows.Forms.Label cityNameLabel;
private System.Windows.Forms.Label siteIntroduceLabel;
private System.Windows.Forms.ComboBox timeZoneComboBox;
private System.Windows.Forms.TextBox longitudeTextBox;
private System.Windows.Forms.TextBox latitudeTextBox;
private System.Windows.Forms.ComboBox cityNameComboBox;
}
}
@@ -0,0 +1,658 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace Revit.SDK.Samples.SharedCoordinateSystem.CS
{
/// <summary>
/// coordinate system data form
/// </summary>
public partial class CoordinateSystemDataForm : System.Windows.Forms.Form
{
CoordinateSystemData m_data; //the reference of the CoordinateSystemData class
string m_currentName; //the current project location's name;
string m_angle; //the value of angle
string m_eastWest; //the value of the east to west offset
string m_northSouth; //the value of the north to south offset
string m_elevation; //the value of the elevation from ground level
string m_newLocationName; //the name of the duplicated location
private PlaceInfo m_placeInfo; //store all cities' information
private SiteLocation m_siteLocation; //reference to SiteLocation
private CityInfo m_currentCityInfo; //current CityInfo
private const int DecimalNumber = 3; //number of decimal
private bool m_isFormLoading = true; //indicate whether called when Form loading
private bool m_isLatitudeChanged = false;//indicate whether user change Latitude value
private bool m_isLongitudeChanged = false;//indicate whether user change Longitude value
/// <summary>
/// get and set the new location's name
/// </summary>
public string NewLocationName
{
get
{
return m_newLocationName;
}
set
{
m_newLocationName = value;
}
}
/// <summary>
/// constructor of form
/// </summary>
private CoordinateSystemDataForm()
{
InitializeComponent();
}
/// <summary>
/// override constructor
/// </summary>
/// <param name="data">a instance of CoordinateSystemData class</param>
public CoordinateSystemDataForm(CoordinateSystemData data, CitySet citySet, SiteLocation siteLocation)
{
m_data = data;
m_currentName = null;
//create new members about place information
m_placeInfo = new PlaceInfo(citySet);
m_siteLocation = siteLocation;
m_currentCityInfo = new CityInfo();
InitializeComponent();
}
/// <summary>
/// display the location information on the form
/// </summary>
private void DisplayInformation()
{
//initialize the listbox
locationListBox.Items.Clear();
foreach (string itemName in m_data.LocationNames)
{
if (itemName == m_data.LocationName)
{
m_currentName = itemName + " (current)"; //indicate the current project location
locationListBox.Items.Add(m_currentName);
}
else
{
locationListBox.Items.Add(itemName);
}
}
//set the selected item to current location
for (int i = 0; i < locationListBox.Items.Count; i++)
{
string itemName = null;
itemName = locationListBox.Items[i].ToString();
if (itemName.Contains("(current)"))
{
locationListBox.SelectedIndex = i;
}
}
//get the offset values of the selected item
string selecteName = locationListBox.SelectedItem.ToString();
m_data.GetOffset(selecteName);
this.ShowOffsetValue();
//set control in placeTabPage
//convert values get from API and set them to controls
CityInfo cityInfo = new CityInfo(m_siteLocation.Latitude, m_siteLocation.Longitude);
CityInfoString cityInfoString = UnitConversion.ConvertFrom(cityInfo);
//set Text of Latitude and Longitude TextBox
latitudeTextBox.Text = cityInfoString.Latitude;
longitudeTextBox.Text = cityInfoString.Longitude;
//set DataSource of CitiesName ComboBox and TimeZones ComboBox
cityNameComboBox.DataSource = m_placeInfo.CitiesName;
timeZoneComboBox.DataSource = m_placeInfo.TimeZones;
//try use Method DoTextBoxChanged to Set CitiesName ComboBox
DoTextBoxChanged();
m_isFormLoading = false;
//get timezone from double value and set control
string timeZoneString = m_placeInfo.TryGetTimeZoneString(m_siteLocation.TimeZone);
//set selectItem of TimeZones ComboBox
timeZoneComboBox.SelectedItem = timeZoneString;
timeZoneComboBox.Enabled = false;
}
/// <summary>
/// load the form
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void CoordinateSystemDataForm_Load(object sender, EventArgs e)
{
this.DisplayInformation();
this.CheckSelecteCurrent();
}
/// <summary>
/// display the duplicate form
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void duplicateButton_Click(object sender, EventArgs e)
{
using (DuplicateForm duplicateForm = new DuplicateForm(m_data,
this,
locationListBox.SelectedItem.ToString()))
{
if (DialogResult.OK != duplicateForm.ShowDialog())
{
return;
}
}
//refresh the form
locationListBox.Items.Clear();
m_data.GatData();
this.DisplayInformation();
//make the new project location is the selected item after it was duplicated
for (int i = 0; i < locationListBox.Items.Count; i++)
{
if (m_newLocationName == locationListBox.Items[i].ToString())
{
locationListBox.SelectedIndex = i;
}
}
}
/// <summary>
/// when the selected item is the current location,make the button to disable
/// </summary>
private void CheckSelecteCurrent()
{
if (locationListBox.SelectedItem.ToString() == m_currentName)
{
makeCurrentButton.Enabled = false;
}
else
{
makeCurrentButton.Enabled = true;
}
//get the offset values of the selected item
string selecteName = locationListBox.SelectedItem.ToString();
m_data.GetOffset(selecteName);
this.ShowOffsetValue();
}
/// <summary>
/// show the offset values on the form
/// </summary>
private void ShowOffsetValue()
{
//show the angle value
char degree = (char)0xb0;
angleTextBox.Text = m_data.AngleOffset.ToString() + degree;
m_angle = m_data.AngleOffset.ToString();
//show the value of the east to west offset
eatWestTextBox.Text = m_data.EastWestOffset.ToString();
m_eastWest = m_data.EastWestOffset.ToString();
//show the value of the north to south offset
northSouthTextBox.Text = m_data.NorthSouthOffset.ToString();
m_northSouth = m_data.NorthSouthOffset.ToString();
//show the value of the elevation
elevationTextBox.Text = m_data.PositionElevation.ToString();
m_elevation = m_data.PositionElevation.ToString();
}
/// <summary>
/// the function will be invoked when the selected item changed
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void locationListBox_SelectedIndexChanged(object sender, EventArgs e)
{
this.CheckSelecteCurrent();
}
/// <summary>
/// close the form and return true
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void okButton_Click(object sender, EventArgs e)
{
if (!this.CheckModify())
{
return;
}
SaveSiteLocation();
this.DialogResult = DialogResult.OK; // set dialog result
this.Close(); // close the form
}
/// <summary>
/// set the selected item of the listbox to be the current project location
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void makeCurrentButton_Click(object sender, EventArgs e)
{
int selectIndex = locationListBox.SelectedIndex; //get selected index
string newCurrentName = locationListBox.SelectedItem.ToString();//get location name
m_data.ChangeCurrentLocation(newCurrentName);
//refresh the form
this.DisplayInformation();
locationListBox.SelectedIndex = selectIndex;
}
/// <summary>
/// check whether user modify the offset value
/// </summary>
private bool CheckModify()
{
try
{
if (m_angle != angleTextBox.Text ||
m_eastWest != eatWestTextBox.Text ||
m_northSouth != northSouthTextBox.Text ||
m_elevation != elevationTextBox.Text)
{
string newValue = angleTextBox.Text;
string degree = ((char)0xb0).ToString();
if (newValue.Contains(degree))
{
int index = newValue.IndexOf(degree);
newValue = newValue.Substring(0, index);
}
double newAngle = Convert.ToDouble(newValue);
double newEast = Convert.ToDouble(eatWestTextBox.Text);
double newNorth = Convert.ToDouble(northSouthTextBox.Text);
double newElevation = Convert.ToDouble(elevationTextBox.Text);
string positionName = locationListBox.SelectedItem.ToString();
m_data.EditPosition(positionName, newAngle, newEast, newNorth, newElevation);
}
}
catch (FormatException)
{
// spacing text boxes should only input number information
TaskDialog.Show("Revit", "Please input double number in TextBox.", TaskDialogCommonButtons.Ok);
return false;
}
catch (Exception ex)
{
// if other unexpected error, just show the information
TaskDialog.Show("Revit", ex.Message, TaskDialogCommonButtons.Ok);
return false;
}
return true;
}
/// <summary>
/// be invoked when SelectedValue of control cityNameComboBox changed
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void cityNameComboBox_SelectedValueChanged(object sender, EventArgs e)
{
//check whether is Focused
if (!cityNameComboBox.Focused)
{
return;
}
DoCityNameChanged();
}
/// <summary>
/// be invoked when SelectValue of control timeZoneComboBox changed
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void timeZoneComboBox_SelectedValueChanged(object sender, EventArgs e)
{
//check whether is Focused
if (!timeZoneComboBox.Focused)
{
return;
}
m_currentCityInfo.TimeZone = m_placeInfo.TryGetTimeZoneNumber(
timeZoneComboBox.SelectedItem as string);
}
/// <summary>
/// be invoked when text changed in control latitudeTextBox
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void latitudeTextBox_TextChanged(object sender, EventArgs e)
{
if (latitudeTextBox.Focused)
{
m_isLatitudeChanged = true;
}
}
/// <summary>
/// be invoked when text changed in control longitudeTextBox
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void longitudeTextBox_TextChanged(object sender, EventArgs e)
{
if (longitudeTextBox.Focused)
{
m_isLongitudeChanged = true;
}
}
/// <summary>
/// be invoked when focus leave control latitudeTextBox
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void latitudeTextBox_Leave(object sender, EventArgs e)
{
if (m_isLatitudeChanged)
{
DoTextBoxChanged();
string text = DealDecimalNumber(latitudeTextBox.Text);
latitudeTextBox.Text = text;
m_isLatitudeChanged = false;
}
}
/// <summary>
/// be invoked when focus leave control longitudeTextBox
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void longitudeTextBox_Leave(object sender, EventArgs e)
{
if (m_isLongitudeChanged)
{
DoTextBoxChanged();
string text = DealDecimalNumber(longitudeTextBox.Text);
longitudeTextBox.Text = text;
m_isLongitudeChanged = false;
}
}
/// <summary>
/// deal with decimal number
/// </summary>
/// <param name="value">string wanted to deal with</param>
/// <returns>result dealing with</returns>
private string DealDecimalNumber(string value)
{
string result;
double doubleValue;
//try to get double value from string
if (!UnitConversion.StringToDouble(value, ValueType.Angle, out doubleValue))
{
string degree = ((char)0xb0).ToString();
if (!value.Contains(degree))
{
result = value + degree;
return result;
}
}
//try to convert double into string
result = UnitConversion.DoubleToString(doubleValue, ValueType.Angle);
return result;
}
/// <summary>
/// call by CitiesNameSelectedChanged,when CitiesName ComboBox selected changed
/// </summary>
private void DoCityNameChanged()
{
//disable timezone ComboBox
timeZoneComboBox.Enabled = false;
CityInfoString cityInfoString = new CityInfoString();
//get new CityInfoString
if (GetCityInfo(cityNameComboBox.SelectedItem as string, out cityInfoString))
{
//use new CityInfoString to set TextBox and ComboBox
latitudeTextBox.Text = cityInfoString.Latitude;
longitudeTextBox.Text = cityInfoString.Longitude;
//set control timeZonesComboBox
if (null != cityInfoString.TimeZone)
{
timeZoneComboBox.Text = null;
timeZoneComboBox.SelectedItem = cityInfoString.TimeZone;
}
else
{
timeZoneComboBox.SelectedIndex = -1;
}
}
//if failed, set control with nothing
else
{
latitudeTextBox.Text = null;
longitudeTextBox.Text = null;
timeZoneComboBox.SelectedIndex = -1;
}
}
/// <summary>
/// called by some functions to do same operation
/// </summary>
private void DoTextBoxChanged()
{
//enable timezone ComboBox
timeZoneComboBox.Enabled = true;
CityInfoString cityInfoString = new CityInfoString(latitudeTextBox.Text, longitudeTextBox.Text);
string cityName;
string timeZone;
//get new CityName and TimeZone
GetCityNameTimeZone(cityInfoString, out cityName, out timeZone);
//use new CityName to set ComboBox
if (null != cityName)
{
cityNameComboBox.Text = null;
cityNameComboBox.SelectedItem = cityName;
timeZoneComboBox.Enabled = false;
}
else
{
if (m_isFormLoading)
{
string userDefinedCity = "User Defined\r";
if (!m_placeInfo.CitiesName.Contains(userDefinedCity))
{
cityNameComboBox.DataSource = null;
m_placeInfo.CitiesName.Add(userDefinedCity);
m_placeInfo.CitiesName.Sort();
cityNameComboBox.DataSource = m_placeInfo.CitiesName;
CityInfo cityInfo = UnitConversion.ConvertTo(cityInfoString);
cityInfo.CityName = userDefinedCity;
cityInfo.TimeZone = m_siteLocation.TimeZone;
m_placeInfo.AddCityInfo(cityInfo);
}
cityNameComboBox.SelectedItem = userDefinedCity;
}
else
{
cityNameComboBox.SelectedIndex = -1;
}
}
//after get timeZone,set control timeZonesComboBox
if (null != timeZone)
{
timeZoneComboBox.Text = null;
timeZoneComboBox.SelectedItem = timeZone;
}
}
/// <summary>
/// used when city information changed
/// </summary>
/// <param name="cityInfoString">city information which changed</param>
/// <param name="cityName">city name want to get according to information</param>
/// <param name="timeZone">city time zone gotten according to information</param>
private void GetCityNameTimeZone(CityInfoString cityInfoString,
out string cityName, out string timeZone)
{
CityInfo cityInfo = UnitConversion.ConvertTo(cityInfoString);
string tempName;
double tempTime;
//try to get city name and timezone according to cityInfo
if (m_placeInfo.TryGetCityNameTimeZone(cityInfo, out tempName, out tempTime))
{
cityName = tempName;
//try to get string representing timezone according to a number
timeZone = m_placeInfo.TryGetTimeZoneString(tempTime);
//set current CityInfo
m_currentCityInfo.Latitude = cityInfo.Latitude;
m_currentCityInfo.Longitude = cityInfo.Longitude;
m_currentCityInfo.TimeZone = tempTime;
m_currentCityInfo.CityName = tempName;
}
else
{
//set current CityInfo
cityName = null;
timeZone = null;
m_currentCityInfo.Latitude = cityInfo.Latitude;
m_currentCityInfo.Longitude = cityInfo.Longitude;
m_currentCityInfo.CityName = null;
}
}
/// <summary>
/// used when city name changed
/// </summary>
/// <param name="cityName">city name which changed</param>
/// <param name="cityInfoString">city information want to get according to city name</param>
/// <returns>check whether is successful</returns>
private bool GetCityInfo(string cityName, out CityInfoString cityInfoString)
{
CityInfo cityInfo = new CityInfo();
//try to get CityInfo according to cityName
if (m_placeInfo.TryGetCityInfo(cityName, out cityInfo))
{
//do conversion from CityInfo to CityInfoString
cityInfoString = UnitConversion.ConvertFrom(cityInfo);
//do TimeZone conversion from double to string
cityInfoString.TimeZone = m_placeInfo.TryGetTimeZoneString(cityInfo.TimeZone);
//set current CityInfo
m_currentCityInfo = cityInfo;
m_currentCityInfo.CityName = cityName;
return true;
}
//if failed, also set current CityInfo
m_currentCityInfo.CityName = null;
cityInfoString = new CityInfoString();
return false;
}
/// <summary>
/// save siteLocation to Revit
/// </summary>
private void SaveSiteLocation()
{
if (null == m_siteLocation)
{
return;
}
//change SiteLocation of Revit
m_siteLocation.Latitude = m_currentCityInfo.Latitude;
m_siteLocation.Longitude = m_currentCityInfo.Longitude;
m_siteLocation.TimeZone = m_currentCityInfo.TimeZone;
}
/// <summary>
/// check the format of the user's input and add a degree symbol behind the angle value
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void angleTextBox_Leave(object sender, EventArgs e)
{
try
{
//check is there any symbol exist in the behind of the value
//and check whether the user's input is number
string degree = ((char)0xb0).ToString();
if (!angleTextBox.Text.Contains(degree))
{
double value = Convert.ToDouble(angleTextBox.Text);
angleTextBox.AppendText(degree);
}
else
{
string tempName = angleTextBox.Text;
int index = tempName.IndexOf(degree);
tempName = tempName.Substring(0, index);
double value = Convert.ToDouble(tempName);
}
}
catch (FormatException)
{
//angle text boxes should only input number information
TaskDialog.Show("Revit", "Please input double number in TextBox.", TaskDialogCommonButtons.Ok);
return;
}
catch (Exception ex)
{
// if other unexpected error, just show the information
TaskDialog.Show("Revit", ex.Message, TaskDialogCommonButtons.Ok);
return;
}
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,131 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
namespace Revit.SDK.Samples.SharedCoordinateSystem.CS
{
/// <summary>
/// dupliate coordiante data form
/// </summary>
partial class DuplicateForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.newNameLabel = new System.Windows.Forms.Label();
this.newNameTextBox = new System.Windows.Forms.TextBox();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// newNameLabel
//
this.newNameLabel.AutoSize = true;
this.newNameLabel.Location = new System.Drawing.Point(36, 15);
this.newNameLabel.Name = "newNameLabel";
this.newNameLabel.Size = new System.Drawing.Size(41, 13);
this.newNameLabel.TabIndex = 0;
this.newNameLabel.Text = "Name :";
//
// newNameTextBox
//
this.newNameTextBox.Location = new System.Drawing.Point(83, 12);
this.newNameTextBox.Name = "newNameTextBox";
this.newNameTextBox.Size = new System.Drawing.Size(210, 20);
this.newNameTextBox.TabIndex = 1;
this.newNameTextBox.Text = "New Location";
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(107, 47);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(90, 25);
this.okButton.TabIndex = 2;
this.okButton.Text = "&OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// cancelButton
//
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(203, 47);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(90, 25);
this.cancelButton.TabIndex = 3;
this.cancelButton.Text = "&Cancel";
this.cancelButton.UseVisualStyleBackColor = true;
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
//
// DuplicateForm
//
this.AcceptButton = this.okButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(302, 84);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.newNameTextBox);
this.Controls.Add(this.newNameLabel);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "DuplicateForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Name";
this.Load += new System.EventHandler(this.DuplicateForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label newNameLabel;
private System.Windows.Forms.TextBox newNameTextBox;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button cancelButton;
}
}
@@ -0,0 +1,113 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit.UI;
namespace Revit.SDK.Samples.SharedCoordinateSystem.CS
{
/// <summary>
/// dupliate coordiante data form
/// </summary>
public partial class DuplicateForm : System.Windows.Forms.Form
{
CoordinateSystemData m_data; //the reference of the CoordinateSystemData class
CoordinateSystemDataForm m_dataForm; //the reference of the CoordinateSystemDataForm class
string m_locationName; //the name of selected location
/// <summary>
/// constructor
/// </summary>
/// <param name="data"></param>
/// <param name="coorinateForm"></param>
/// <param name="locationName"></param>
public DuplicateForm(CoordinateSystemData data, CoordinateSystemDataForm coorinateForm,
string locationName)
{
m_data = data;
m_dataForm = coorinateForm;
m_locationName = locationName;
InitializeComponent();
}
/// <summary>
/// duplicate a new project location
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void okButton_Click(object sender, EventArgs e)
{
//check whether the name has been used
foreach (string name in m_data.LocationNames)
{
if (name == newNameTextBox.Text)
{
TaskDialog.Show("Revit", "The name entered is already in use. Enter a unique name.", TaskDialogCommonButtons.Ok);
return;
}
}
try
{
m_data.DuplicateLocation(m_locationName, newNameTextBox.Text);
m_dataForm.NewLocationName = newNameTextBox.Text;
}
catch (ArgumentException ex)
{
TaskDialog.Show("Revit", ex.Message, TaskDialogCommonButtons.Ok);
return;
}
this.DialogResult = DialogResult.OK; // set dialog result
this.Close(); // close the form
}
/// <summary>
/// cancel the command
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void cancelButton_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;// set dialog result
this.Close(); // close the form
}
/// <summary>
/// invoked while the form was been loaded
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void DuplicateForm_Load(object sender, EventArgs e)
{
newNameTextBox.Focus();
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,566 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.IO;
using System.Windows.Forms;
using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace Revit.SDK.Samples.SharedCoordinateSystem.CS
{
/// <summary>
/// a struct used to describe information about city
/// </summary>
public struct CityInfo
{
double m_timeZone; //Timezone in which the city resides
double m_latitude; //Latitude of the city
double m_longitude; //Longitude of the city
string m_cityName; //name of city
/// <summary>
/// property used to get and set TimeZone
/// </summary>
public double TimeZone
{
get
{
return m_timeZone;
}
set
{
m_timeZone = value;
}
}
/// <summary>
/// property used to get and set Latitude
/// </summary>
public double Latitude
{
get
{
return m_latitude;
}
set
{
m_latitude = value;
}
}
/// <summary>
/// property used to get and set Longitude
/// </summary>
public double Longitude
{
get
{
return m_longitude;
}
set
{
m_longitude = value;
}
}
/// <summary>
/// property used to get and set city name
/// </summary>
public string CityName
{
get
{
return m_cityName;
}
set
{
m_cityName = value;
}
}
/// <summary>
/// class CityInfo's constructor
/// </summary>
/// <param name="latitude">latitude of city</param>
/// <param name="longitude">longitude of city</param>
public CityInfo(double latitude, double longitude)
{
m_latitude = latitude;
m_longitude = longitude;
m_timeZone = PlaceInfo.InvalidTimeZone;
m_cityName = null;
}
/// <summary>
/// class CityInfo's constructor
/// </summary>
/// <param name="latitude">latitude of city</param>
/// <param name="longitude">longitude of city</param>
/// <param name="timeZone">timezone of city</param>
/// <param name="cityName">city name</param>
public CityInfo(double latitude, double longitude, double timeZone, string cityName)
{
m_timeZone = timeZone;
m_latitude = latitude;
m_longitude = longitude;
m_cityName = cityName;
}
}
/// <summary>
/// a struct used to describe information about city
/// displayed in Form and it's members are string type
/// </summary>
public struct CityInfoString
{
string m_timeZone; //Timezone in which the city resides
string m_latitude; //Latitde of the city
string m_longitude; //Longitude of the city
/// <summary>
/// property used to get and set TimeZone
/// </summary>
public string TimeZone
{
get
{
return m_timeZone;
}
set
{
m_timeZone = value;
}
}
/// <summary>
/// property used to get and set Latitude
/// </summary>
public string Latitude
{
get
{
return m_latitude;
}
set
{
m_latitude = value;
}
}
/// <summary>
/// property used to get and set Longitude
/// </summary>
public string Longitude
{
get
{
return m_longitude;
}
set
{
m_longitude = value;
}
}
/// <summary>
/// class CityInfo's constructor
/// </summary>
/// <param name="latitude">latitude of city</param>
/// <param name="longitude">longitude of city</param>
public CityInfoString(string latitude, string longitude)
{
m_latitude = latitude;
m_longitude = longitude;
m_timeZone = null;
}
/// <summary>
/// class CityInfo's constructor
/// </summary>
/// <param name="latitude">latitude of city</param>
/// <param name="longitude">longitude of city</param>
/// <param name="timeZone">timezone of city</param>
public CityInfoString(string latitude, string longitude, string timeZone)
{
m_timeZone = timeZone;
m_latitude = latitude;
m_longitude = longitude;
}
}
/// <summary>
/// a class used to store information of all city
/// include it's name,Latitude,longitude,timezone
/// </summary>
public class PlaceInfo
{
private List<string> m_citiesName; //city's name
private List<CityInfo> m_citiesInfo; //information of all cities,such Latitude,longitude
private List<string> m_timeZones; //timezone information of all cities
private bool m_isTimeZonesValid; //figure out whether can get timezone information
private const double Diff = 0.0001; //used to check whether two double values are equal
private static readonly double m_invalidTimeZone = -13; //value used when can't get timezone
/// <summary>
/// property used to get and set all cities' name
/// </summary>
public List<string> CitiesName
{
get
{
return m_citiesName;
}
set
{
m_citiesName = value;
}
}
/// <summary>
/// property used to get and set all timezone
/// </summary>
public List<string> TimeZones
{
get
{
return m_timeZones;
}
set
{
m_timeZones = value;
}
}
/// <summary>
/// property used to get Invalid timezone
/// </summary>
public static double InvalidTimeZone
{
get
{
return m_invalidTimeZone;
}
}
/// <summary>
/// class PlaceInfo's constructor
/// </summary>
/// <param name="cities"></param>
public PlaceInfo(CitySet cities)
{
Initialize(cities);
}
/// <summary>
/// initialize function
/// </summary>
/// <param name="cities">a set store all cities</param>
/// <returns></returns>
public bool Initialize(CitySet cities)
{
m_citiesInfo = new List<CityInfo>();
m_citiesName = new List<string>();
m_timeZones = new List<string>();
if (InitCities(cities) && InitTimeZone())
{
return true;
}
return false;
}
/// <summary>
/// Add a city info to city info List
/// </summary>
/// <param name="cityInfo">the city info need to add</param>
public void AddCityInfo(CityInfo cityInfo)
{
if (m_citiesInfo.Contains(cityInfo))
{
return;
}
m_citiesInfo.Add(cityInfo);
}
/// <summary>
/// try to get city name according to CityInfo
/// </summary>
/// <param name="cityInfo">store information about city</param>
/// <param name="cityName">city's name</param>
/// <param name="timeZone">city's timezone</param>
/// <returns>figure out whether this function successful</returns>
public bool TryGetCityNameTimeZone(CityInfo cityInfo, out string cityName, out double timeZone)
{
cityName = null;
timeZone = m_invalidTimeZone;
//loop to find cityinfo matched
foreach (CityInfo temp in m_citiesInfo)
{
//compare Latitude and longitude,and if difference < Diff
// the two CityInfo are equal
if (Math.Abs(temp.Latitude - cityInfo.Latitude) < Diff &&
Math.Abs(temp.Longitude - cityInfo.Longitude) < Diff)
{
cityName = temp.CityName;
timeZone = temp.TimeZone;
return true;
}
}
return false;
}
/// <summary>
/// try to get city info according to city name
/// </summary>
/// <param name="cityName">city name</param>
/// <param name="cityInfo">city's information</param>
/// <returns>figure out whether this function successful</returns>
public bool TryGetCityInfo(string cityName, out CityInfo cityInfo)
{
//compare cityName with element's CityName of m_citiesInfo
//if they are equal, that element is matched
foreach (CityInfo temp in m_citiesInfo)
{
if (cityName == temp.CityName)
{
cityInfo = temp;
return true;
}
}
cityInfo = new CityInfo();
return false;
}
/// <summary>
/// try to get city's timezone
/// </summary>
/// <param name="timeZoneNumber">time zone</param>
/// <returns>figure out whether this function successful</returns>
public string TryGetTimeZoneString(double timeZoneNumber)
{
//if Initialize faied or timeZoneNumber is not in range -12 to 12, return null
if (!m_isTimeZonesValid || timeZoneNumber > 13 || timeZoneNumber < -12)
{
return null;
}
string timeZoneString = null;
string temp = null;
//try to get a string like "(GMT+08:00)",
//the number in string associate with timeZoneNumber
//first if timeZoneNumber is 0
if (0 == timeZoneNumber)
{
temp = "(GMT)";
}
else
{
//if timeZoneNumber > 0
if (timeZoneNumber > 0)
{
if (timeZoneNumber > 9)
{
temp = "(GMT+";
}
else
{
temp = "(GMT+0";
}
}
//if timeZoneNumber < 0
else
{
if (timeZoneNumber < -9)
{
temp = "(GMT-";
}
else
{
temp = "(GMT-0";
}
}
//if timeZoneNumber is not int, append ":30" to string
int intNumber = (int)timeZoneNumber;
if (0.5 == Math.Abs(timeZoneNumber - intNumber))
{
temp += Math.Abs(intNumber) + ":30)";
}
else
{
temp += Math.Abs(intNumber) + ":00)";
}
}
//try to find string in list m_timeZones contains string get above
for (int i = 0; i < m_timeZones.Count; i++)
{
if (m_timeZones[i].Contains(temp))
{
//here, use last member of list contains that string as result.
timeZoneString = m_timeZones[i];
}
}
return timeZoneString;
}
/// <summary>
/// try to get TimeZone's number from a string
/// </summary>
/// <param name="timeZoneString">a string store TimeZone</param>
/// <returns>result Parse from string</returns>
public double TryGetTimeZoneNumber(string timeZoneString)
{
bool isPlus;
double result = 0;
//check timezone is plus, zero or negative
if (timeZoneString.Contains("+"))
{
isPlus = true;
}
else if (timeZoneString.Contains("-"))
{
isPlus = false;
}
else
{
return result;
}
//get int and decimal part of timezone
string intString = timeZoneString.Substring(5, 2);
string decimalString = timeZoneString.Substring(8, 1);
double intNumber;
double decimalNumber;
//try to get double from string using method Double.TryParse
if (Double.TryParse(intString, out intNumber) &&
Double.TryParse(decimalString, out decimalNumber))
{
//if decimal part is not zero, add 0.5 after int part
if (0 != decimalNumber)
{
result = intNumber + 0.5;
}
else
{
result = intNumber;
}
}
//if timezone is negative, add minus
if (!isPlus)
{
result *= -1;
}
return result;
}
/// <summary>
/// initialize cities
/// </summary>
/// <param name="cities"></param>
/// <returns></returns>
private bool InitCities(CitySet cities)
{
if (null == cities)
{
return false;
}
//add all element of CitySet cities to List m_cities
CitySetIterator iter = cities.ForwardIterator();
iter.Reset();
for (; iter.MoveNext(); )
{
City city = iter.Current as City;
if (null == city)
{
continue;
}
m_citiesName.Add(city.Name);
m_citiesInfo.Add(new CityInfo(city.Latitude, city.Longitude, city.TimeZone, city.Name));
}
//sort list according to first char of element
m_citiesName.Sort();
return true;
}
/// <summary>
/// initialize timezone
/// </summary>
/// <returns></returns>
private bool InitTimeZone()
{
StreamReader streamReader = null;
try
{
//open file store timezone
string filepath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
if (!filepath.EndsWith("\\"))
{
filepath += "\\";
}
filepath += "timezone.txt";
streamReader = File.OpenText(filepath);
//add timezone to m_timeZones
while (!streamReader.EndOfStream)
{
string text = streamReader.ReadLine();
if (null != text)
{
m_timeZones.Add(text);
}
}
}
catch (Exception e)
{
m_isTimeZonesValid = false;
//show message to tell user that initialize failed
TaskDialog.Show("Revit", e.Message);
return false;
}
finally
{
//close file resource
if (null != streamReader)
{
streamReader.Close();
}
}
m_isTimeZonesValid = true;
return true;
}
}
}
@@ -0,0 +1,57 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SharedCoordinateSystem")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SharedCoordinateSystem")]
[assembly: AssemblyCopyright("Copyright © Autodesk, Inc. 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d76463b8-1c82-4b26-8d49-0dc234841f40")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<RevitAddIns>
<AddIn Type="Command">
<Assembly>SharedCoordinateSystem.dll</Assembly>
<ClientId>56ce972e-d4d5-4631-ad35-6f280747abe3</ClientId>
<FullClassName>Revit.SDK.Samples.SharedCoordinateSystem.CS.Command</FullClassName>
<Text>Shared Coordinate System</Text>
<Description>Display the locations and site information of the project.</Description>
<VisibilityMode>AlwaysVisible</VisibilityMode>
<VendorId>ADSK</VendorId>
<VendorDescription>Autodesk, www.autodesk.com</VendorDescription>
</AddIn>
</RevitAddIns>
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{7E14896B-D571-4927-A55A-05DD26193312}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SharedCoordinateSystem</RootNamespace>
<AssemblyName>SharedCoordinateSystem</AssemblyName>
<SccProjectName>
</SccProjectName>
<SccLocalPath>
</SccLocalPath>
<SccAuxPath>
</SccAuxPath>
<SccProvider>
</SccProvider>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup>
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Command.cs" />
<Compile Include="CoordinateSystemData.cs" />
<Compile Include="CoordinateSystemDataForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CoordinateSystemDataForm.Designer.cs">
<DependentUpon>CoordinateSystemDataForm.cs</DependentUpon>
</Compile>
<Compile Include="DuplicateForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="DuplicateForm.Designer.cs">
<DependentUpon>DuplicateForm.cs</DependentUpon>
</Compile>
<Compile Include="PlaceInfo.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UnitConversion.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="CoordinateSystemDataForm.resx">
<SubType>Designer</SubType>
<DependentUpon>CoordinateSystemDataForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DuplicateForm.resx">
<SubType>Designer</SubType>
<DependentUpon>DuplicateForm.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(SolutionDir)VSProps\SDKSamples.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<PropertyGroup>
<PostBuildEvent>set FILEFORSAMPLEREG="$(SolutionDir)..\..\..\..\Regression\API\SDKSamples\UpdateSampleDllForRegression.pl"
if exist %25FILEFORSAMPLEREG%25 perl %25FILEFORSAMPLEREG%25 $(ProjectExt) "$(ProjectPath)" "$(TargetPath)" "$(SolutionDir)"</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>
</Project>
@@ -0,0 +1,316 @@
//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
//
using System;
using System.Collections.Generic;
using System.Globalization;
namespace Revit.SDK.Samples.SharedCoordinateSystem.CS
{
/// <summary>
/// define type of value
/// </summary>
public enum ValueType
{
/// <summary>
/// general value
/// </summary>
General = 0,
/// <summary>
/// angle value
/// </summary>
Angle
}
/// <summary>
/// a class used to deal with converting operation
/// </summary>
public class UnitConversion
{
private static readonly int DefaultPrecision = 3; //default precision
private static readonly double AngleRatio = 0.0174532925199433; //ratio of Angle
/// <summary>
/// convert CityInfo into CityInfoString
/// </summary>
/// <param name="cityInfo">CityInfo need to convert</param>
/// <returns>conversion result</returns>
public static CityInfoString ConvertFrom(CityInfo cityInfo)
{
CityInfoString cityInfoString = new CityInfoString();
cityInfoString.Latitude = DoubleToString(cityInfo.Latitude, ValueType.Angle);
cityInfoString.Longitude = DoubleToString(cityInfo.Longitude, ValueType.Angle);
return cityInfoString;
}
/// <summary>
/// convert CityInfoString into CityInfo
/// </summary>
/// <param name="cityInfoString">CityInfoString need to convert</param>
/// <returns>conversion result</returns>
public static CityInfo ConvertTo(CityInfoString cityInfoString)
{
CityInfo cityInfo = new CityInfo();
double temp;
//convert Latitude
if (StringToDouble(cityInfoString.Latitude, ValueType.Angle, out temp))
{
cityInfo.Latitude = temp;
}
else
{
cityInfo.Latitude = Double.NaN;
}
//convert Longitude
if (StringToDouble(cityInfoString.Longitude, ValueType.Angle, out temp))
{
cityInfo.Longitude = temp;
}
else
{
cityInfo.Longitude = Double.NaN;
}
return cityInfo;
}
/// <summary>
/// deal with value according to precision
/// </summary>
/// <param name="value">original value will be dealed</param>
/// <param name="precision">precision wanted to be set</param>
/// <returns>return the dealed value</returns>
public static double DealPrecision(double value, int precision)
{
//first make sure 0 =< precision <= 15
if (precision < 0 && precision > 15)
{
return value;
}
//if >1 or < -1,just use Math.Round to deal with
double newValue;
if (value >= 1 || value <= -1 || 0 == value)
{
//Math.Round: returns the number with the specified precision
//nearest the specified value.
newValue = Math.Round(value, precision);
return newValue;
}
//if -1 < value < 1,
//find first number which is not "0"
//compare it with precision, then select
//min of them as final precision
int firstNumberPos = 0;
double temp = Math.Abs(value);
for (firstNumberPos = 1; ; firstNumberPos++)
{
temp *= 10;
if (temp >= 1)
{
break;
}
}
//make sure firstNumberPos <= 15
if (firstNumberPos > 15)
{
firstNumberPos = 15;
}
//Math.Round: returns the number with the specified precision
//nearest the specified value.
newValue = Math.Round(value, firstNumberPos > precision ? firstNumberPos : precision);
return newValue;
}
/// <summary>
/// convert double into string
/// </summary>
/// <param name="value">double value need to convert</param>
/// <param name="valueType">value type</param>
/// <returns>conversion result</returns>
public static string DoubleToString(double value, ValueType valueType)
{
string displayText = null; // string included value and unit of parameter
double newValue;
ValueConversion(value, ValueType.Angle, true, out newValue);
value = newValue;
newValue = DealPrecision(value, DefaultPrecision);
//calculate the number after ".",if less than DecimalNumber
// add some "0" after it
displayText = DealDecimalNumber(newValue.ToString(), DefaultPrecision);
if(ValueType.Angle == valueType)
{
char degree = (char)0xb0;
displayText += degree;
}
return displayText;
}
/// <summary>
/// deal with decimal number
/// </summary>
/// <param name="value">string wanted to deal with</param>
/// <param name="number">number of decimal</param>
/// <returns>result dealing with</returns>
public static string DealDecimalNumber(string value, int number)
{
string newValue = value;
int dist;
if (newValue.Contains("."))
{
int index = newValue.IndexOf(".");
dist = newValue.Length - (index + 1);
}
else
{
dist = 0;
newValue += ".";
}
if (dist < number)
{
for (int i = 0; i < number - dist; i++)
{
newValue += "0";
}
}
return newValue;
}
/// <summary>
/// convert string into double
/// </summary>
/// <param name="value">string value need to convert</param>
/// <param name="valueType">value type</param>
/// <param name="newValue">conversion result</param>
/// <returns>if success, return true; otherwise, return false</returns>
public static bool StringToDouble(string value, ValueType valueType, out double newValue)
{
newValue = 0;
if (null == value)
{
return false;
}
//try to Parse double from string
double result;
if (ParseFromString(value, valueType, out result))
{
//deal with ratio
ValueConversion(result, valueType, false, out newValue);
return true;
}
return false;
}
/// <summary>
/// Parse double from string
/// </summary>
/// <param name="value">string value</param>
/// <param name="valueType">value type</param>
/// <param name="result">conversion result</param>
/// <returns>if success, return true; otherwise, return false</returns>
private static bool ParseFromString(string value, ValueType valueType, out double result)
{
string newValue = null;
string degree = ((char)0xb0).ToString();
//if nothing, set result = 0;
if (value.Length == 0)
{
result = 0;
return true;
}
else if (ValueType.General == valueType)
{
}
//check if contain degree symbol
else if (value.Contains(degree))
{
int index = value.IndexOf(degree);
newValue = value.Substring(0, index);
}
//check if have string" " ,for there is string" "
//between value and unit when show in PropertyGrid
else if (value.Contains(" "))
{
int index = value.IndexOf(" ");
newValue = value.Substring(0, index);
}
//finally if don't have unit name in it
//other situation, set newValue = value
else
{
newValue = value;
}
//double.TryParse's return value:
//true if s is converted successfully; otherwise, false.
if (double.TryParse(newValue, out result))
{
return true;
}
return false;
}
/// <summary>
/// deal with ratio
/// </summary>
/// <param name="value">value need to deal with</param>
/// <param name="valueType">value type</param>
/// <param name="isDoubleToString">
/// figure out whether be called by function "DoubleToString"
/// </param>
/// <param name="newValue"></param>
private static void ValueConversion(double value, ValueType valueType,
bool isDoubleToString, out double newValue)
{
//ValueType.General == valueType,do nothing and return
if (ValueType.General == valueType)
{
newValue = value;
return;
}
//otherwise,check whether be called by function "DoubleToString"
if (isDoubleToString)
{
newValue = value / AngleRatio;
}
else
{
newValue = value * AngleRatio;
}
}
}
}
@@ -0,0 +1,84 @@
(GMT-12:00) International Date Line West
(GMT-11:00) Midway Island, Samoa
(GMT-10:00) Hawaii
(GMT-09:00) Alaska
(GMT-08:00) Pacific Time (US/Canada)
(GMT-08:00) Tijuana, Baja California
(GMT-07:00) Arizona
(GMT-07:00) Chihuahua, La Paz, Mazatlan - New
(GMT-07:00) Chihuahua, La Paz, Mazatlan - Old
(GMT-07:00) Mountain Time (US/Canada)
(GMT-06:00) Central America
(GMT-06:00) Central Time (US/Canada)
(GMT-06:00) Guadalajara, Mexico City, Monterrey - New
(GMT-06:00) Guadalajara, Mexico City, Monterrey - Old
(GMT-06:00) Saskatchewan
(GMT-05:00) Bogota, Lima, Quito, Rio Branco
(GMT-05:00) Eastern Time (US/Canada)
(GMT-05:00) Indiana (East)
(GMT-04:00) Atlantic Time (Canada)
(GMT-04:00) Caracas, La Paz
(GMT-04:00) Santiago
(GMT-03:30) Newfoundland
(GMT-03:00) Brazilia
(GMT-03:00) Buanos Aires, Georgetown
(GMT-03:00) Greenland
(GMT-03:00) Montevideo
(GMT-02:00) Mid-Atlantic
(GMT-01:00) Azores
(GMT-01:00) Cape Verde Is.
(GMT) Casablanca, Monrovia,Reykjavik
(GMT) Greenwich Time: Dublin, Edinburgh, Lisbon, London
(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna
(GMT+01:00) Belgrade, Brastislava, Budapest, Ljubljana, Prague
(GMT+01:00) Brussels, Copenhagen, Madrid, Paris
(GMT+01:00) Sarajevo, Skopje, Sofija, Vilnus, Warsaw, Zagreb
(GMT+01:00) West Central Africa
(GMT+02:00) Amman
(GMT+02:00) Athens, Bucharest, Istanbul
(GMT+02:00) Beirut
(GMT+02:00) Cairo
(GMT+02:00) Harare, Pretoria
(GMT+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius
(GMT+02:00) Jerusalem
(GMT+02:00) Minsk
(GMT+02:00) Windhoek
(GMT+03:00) Baghdad
(GMT+03:00) Kuwait, Riyadh
(GMT+03:00) Moscow, St. Petersburg, Volgograd
(GMT+03:00) Nairobi
(GMT+03:00) Tbilisi
(GMT+03:00) Tehran
(GMT+04:00) Abu Dhabi, Muscat
(GMT+04:00) Baku
(GMT+04:00) Yerevan
(GMT+04:30) Kabul
(GMT+05:00) Ekaterinburg
(GMT+05:00) Islamabad, Karachi, Tashkent
(GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi
(GMT+05:30) Sri Jayawardenepura
(GMT+05:45) Kathmandu
(GMT+06:00) Almaty, Novosibirsk
(GMT+06:00) Astana, Dhaka
(GMT+06:30) Yangon (Rangoon)
(GMT+07:00) Bangkok, Hanoi, Jakarta
(GMT+07:00) Krasnoyarsk
(GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi
(GMT+08:00) Irkutsk, Ulaan Bataar
(GMT+08:00) Kuala Lumpur, Singapore
(GMT+08:00) Perth
(GMT+08:00) Taipei
(GMT+09:00) Osaka, Sapporo, Tokyo
(GMT+09:00) Seoul
(GMT+09:00) Yakutsk
(GMT+09:30) Adelaide
(GMT+09:30) Darwin
(GMT+10:00) Brisbane
(GMT+10:00) Canberra, Melbourne, Sydney
(GMT+10:00) Guam, Port Moresby
(GMT+10:00) Hobart
(GMT+10:00) Vladivostok
(GMT+11:00) Magadan, Solomon Is., New Caledonia
(GMT+12:00) Aukland, Wellington
(GMT+12:00) Fiji, Kamchatka, Marshall Is.
(GMT+13:00) Nubu'alofa