本文整理汇总了C#中Distance.SetFixed方法的典型用法代码示例。如果您正苦于以下问题:C# Distance.SetFixed方法的具体用法?C# Distance.SetFixed怎么用?C# Distance.SetFixed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Distance
的用法示例。
在下文中一共展示了Distance.SetFixed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeControl
internal void InitializeControl(IntersectForm parent, int dirNum)
{
// Default settings for direction radio buttons.
TurnRadioOff(clockwiseRadioButton);
TurnRadioOff(counterClockwiseRadioButton);
// Default settings for offset radio buttons (not checked, not enabled)
TurnRadioOff(leftRadioButton);
TurnRadioOff(rightRadioButton);
// Clear the button that lets the displayed offset value be set as default
setDefaultOffsetButton.Enabled = false;
// If we've got a default offset, display it (and set the
// appropriate radio button)
string value = GlobalUserSetting.Read(DEFAULT_OFFSET_KEY);
if (value.Length > 0)
{
m_DefaultOffset = new Distance(value);
if (m_DefaultOffset.IsDefined)
m_DefaultOffset.SetFixed();
else
m_DefaultOffset = null;
}
// Initialize combo box with a list of all line entity types
// for the currently active theme.
m_LineType = lineTypeComboBox.Load(SpatialType.Line);
if (m_DefaultOffset!=null)
{
lineTypeComboBox.SelectEntity(null);
lineTypeGroupBox.Enabled = false;
m_LineType = null;
}
if (parent is IntersectDirectionAndLineForm)
{
// For direction-line intersections, the default is NOT
// to add a line, so if we're not doing an update, make
// sure the line type is undefined.
if (parent.GetUpdateOp()==null)
{
lineTypeComboBox.SelectEntity(null);
//lineTypeGroupBox.Enabled = false;
m_LineType = null;
}
}
// If we are updating a feature that was previously created (or recalling
// a previous edit), load the original info. For direction-direction intersections,
// we need to know which page this is, to determine whether we
// should display info for the 1st or 2nd direction.
IntersectOperation op = parent.GetUpdateOp();
if (op == null)
op = parent.GetRecall();
if (!ShowUpdate(op, (byte)dirNum))
{
// Display default offset (if there is one). Setting the text will cause
// a call to OnChangeOffset, which will define m_Offset & m_IsRight
if (m_DefaultOffset!=null)
offsetTextBox.Text = m_DefaultOffset.Format();
}
// Go to the first text box
fromPointTextBox.Focus();
}
示例2: OnOffsetDistance
/// <summary>
/// Parses an explicitly entered offset distance.
/// </summary>
/// <returns></returns>
bool OnOffsetDistance()
{
// Null out the current offset.
m_OffsetDistance = null;
// Get the entered string.
string str = offsetTextBox.Text.Trim();
if (str.Length==0)
return false;
// If all we have is a "-", disable the ability to specify
// offset right & return.
if (str[0] == '-')
{
TurnRadioOff(rightRadioButton);
leftRadioButton.Checked = true;
if (str.Length==1)
return false;
}
// Parse the distance.
Distance dist = new Distance(str);
if (!dist.IsDefined)
{
MessageBox.Show("Offset distance contains extraneous characters.");
return false;
}
// Save the entered distance (in the current data entry units if
// units were not specified). Make it a fixed distance.
m_OffsetDistance = dist;
m_OffsetDistance.SetFixed();
// If we have signed offset, it HAS to be an offset to the
// left. Otherwise make sure we preserve the directional sense.
// which may have been previously defined.
if (m_OffsetDistance.SetPositive()) // i.e. the offset had to be
m_IsRight = false; // made positive => offset left
else
m_IsRight = true;
// If the offset is signed, make it an offset left and
// disable the ability to make it an offset right.
if (m_IsRight)
SetOffsetRight();
else
SetOffsetLeft();
return true;
}
示例3: setDefaultOffsetButton_Click
private void setDefaultOffsetButton_Click(object sender, EventArgs e)
{
// The following message should have been trapped already,
// displayed only to reveal potential bug
if (m_OffsetPoint!=null)
{
MessageBox.Show("Can't set default if offset is defined via a point feature.");
return;
}
// Handle case where no offset is defined (remove from registry)
if (m_OffsetDistance==null || Math.Abs(m_OffsetDistance.Meters) < Constants.TINY)
{
GlobalUserSetting.Write(DEFAULT_OFFSET_KEY, String.Empty);
return;
}
// Handle a defined value, prepending with a "-" character
// if the offset is to the left
string value = m_OffsetDistance.Format();
if (!m_IsRight)
value = "-" + value;
GlobalUserSetting.Write(DEFAULT_OFFSET_KEY, value);
// Remember the new default (it's different from m_OffsetDistance if
// it's an offset to the left)
m_DefaultOffset = new Distance(value);
m_DefaultOffset.SetFixed();
// Disable the button (the user has to change it in order to re-enable)
setDefaultOffsetButton.Enabled = false;
}