本文整理汇总了C#中Expr.IsPoint方法的典型用法代码示例。如果您正苦于以下问题:C# Expr.IsPoint方法的具体用法?C# Expr.IsPoint怎么用?C# Expr.IsPoint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Expr
的用法示例。
在下文中一共展示了Expr.IsPoint方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Match
public object Match(Expr exp)
{
var dict = new Dictionary<PatternEnum, object>();
object obj;
bool result = exp.IsLabel(out obj);
if (result) dict.Add(PatternEnum.Label, obj); //string
result = exp.IsPoint(out obj); //Algebraic point form
if (result) dict.Add(PatternEnum.Point, obj); //PointSymbol
result = exp.IsQuery(out obj);
if (result) dict.Add(PatternEnum.Query, obj); //EqGoal or Equation
result = exp.IsEquationLabel(out obj);
if (result)
{
var eq = obj as Equation;
Debug.Assert(eq != null);
LineSymbol ls = null;
try
{
result = eq.IsLineEquation(out ls); //Algebraic line form
}
catch (Exception)
{
}
if (result) dict.Add(PatternEnum.Line, ls); //LineSymbol
eq.UnEval();
eq.CachedEntities.Clear();
object obj1 = null;
try
{
result = eq.IsEqGoal(out obj1); //Property form
}
catch (Exception)
{
}
var eqGoal = obj1 as EqGoal;
var eqGoalLst = obj1 as List<object>;
if (result)
{
if(eqGoal != null) dict.Add(PatternEnum.Goal, eqGoal); //EqGoal
if(eqGoalLst != null) dict.Add(PatternEnum.Goal, eqGoalLst); // list of EqGoal
}
if (dict.Count != 0)
{
return dict.Count == 1 ? dict.Values.ToList()[0] : dict;
}
eq.UnEval();
eq.CachedEntities.Clear();
CircleSymbol cs;
result = eq.IsCircleEquation(out cs);
if (result) dict.Add(PatternEnum.Circle, cs);
if (dict.Count == 0)
{
dict.Add(PatternEnum.Equation, eq);
}
}
//relation
LineSymbol lsr;
result = exp.IsLineRel(out lsr);
if (result) dict.Add(PatternEnum.Line, lsr); //LineSymbol
return dict.Count == 1 ? dict.Values.ToList()[0] : dict;
}
示例2: UserMatch
public object UserMatch(Expr exp)
{
var dict = new Dictionary<PatternEnum, object>();
object obj;
bool result = exp.IsLabel(out obj);
if (result) dict.Add(PatternEnum.Label, obj); //string
result = exp.IsPoint(out obj); //Algebraic point form
if (result) dict.Add(PatternEnum.Point, obj); //PointSymbol
result = exp.IsQuery(out obj);
if (result) dict.Add(PatternEnum.Query, obj); //EqGoal or Equation
if (dict.Count != 0)
{
return dict.Count == 1 ? dict.Values.ToList()[0] : dict;
}
result = exp.IsNumeric(out obj);
if (result)
{
dict.Add(PatternEnum.Numeric, obj);
return obj;
}
result = exp.IsTerm(out obj);
if (result)
{
dict.Add(PatternEnum.Term, obj);
return obj;
}
result = exp.IsExpression(out obj);
if (result)
{
dict.Add(PatternEnum.Expression, obj);
return obj;
}
result = exp.IsEquationLabel(out obj);
if (result)
{
var eq = obj as Equation;
Debug.Assert(eq != null);
if (dict.Count == 0)
{
dict.Add(PatternEnum.Equation, eq);
return obj;
}
LineSymbol ls;
result = eq.IsLineEquation(out ls, false); //Algebraic line form
if (result)
{
dict.Add(PatternEnum.Line, ls); //LineSymbol
//return ls;
}
eq.UnEval();
object obj1;
result = eq.IsEqGoal(out obj1, false); //Property form
var eqGoal = obj1 as EqGoal;
if (result && eqGoal!=null)
{
dict.Add(PatternEnum.Goal, ls); //LineSymbol
//return eqGoal;
}
eq.UnEval();
}
//relation
LineSymbol lsr;
result = exp.IsLineRel(out lsr);
if (result) dict.Add(PatternEnum.Line, lsr); //LineSymbol
return dict.Count == 1 ? dict.Values.ToList()[0] : dict;
}