/// <summary> /// Executes this operation. /// </summary> /// <param name="pointId"></param> /// <param name="lineType"></param> internal void Execute(IdHandle pointId, IEntity lineType) { // Calculate the position of the sideshot point. IPosition to = Calculate(m_Direction, m_Length); if (to == null) { throw new Exception("Cannot calculate position of sideshot point."); } FeatureFactory ff = new FeatureFactory(this); FeatureId fid = pointId.CreateId(); IFeature x = new FeatureStub(this, pointId.Entity, fid); ff.AddFeatureDescription(DataField.To, x); if (lineType != null) { IFeature f = new FeatureStub(this, lineType, null); ff.AddFeatureDescription(DataField.Line, f); } base.Execute(ff); }
public override int GetHashCode() { int hash = 1; if (defaultValueCase_ == DefaultValueOneofCase.Id) { hash ^= Id.GetHashCode(); } if (defaultValueCase_ == DefaultValueOneofCase.FeatureId) { hash ^= FeatureId.GetHashCode(); } if (defaultValueCase_ == DefaultValueOneofCase.Bval) { hash ^= Bval.GetHashCode(); } if (defaultValueCase_ == DefaultValueOneofCase.Lval) { hash ^= Lval.GetHashCode(); } if (defaultValueCase_ == DefaultValueOneofCase.Sval) { hash ^= Sval.GetHashCode(); } if (defaultValueCase_ == DefaultValueOneofCase.Fval) { hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(Fval); } hash ^= (int)defaultValueCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
/// <summary> /// Obtains any miscellaneous attribute data for a specific spatial object /// </summary> /// <param name="so">The object of interest</param> /// <returns>Any attributes for the spatial object (never null, but may be an empty list)</returns> List <Row> GetRows(ISpatialObject so) { List <Row> result = new List <Row>(); Feature f = (so as Feature); if (f == null && so is Polygon) { f = (so as Polygon).Label; } if (f != null && f.FeatureId != null) { FeatureId fid = f.FeatureId; IPossibleList <Row> rows = fid.Rows; if (rows != null) { foreach (Row r in rows) { result.Add(r); } } } return(result); }
public IDisposable LogBlock(FeatureId featureId, FunctionId functionId, string message, int blockId, CancellationToken cancellationToken) { var block = etwBlocksPool.Allocate(); block.Construct(functionId, message, blockId, cancellationToken); return(block); }
/// <summary> /// Creates a new point, based on the information stored in the /// dialog. It is assumed that validation has already been done (see OnOK). /// </summary> /// <returns></returns> internal PointFeature Save() { // Handle 3D points some other day if (Math.Abs(m_Elevation) > Double.Epsilon) { throw new NotImplementedException("NewPointForm.Save - 3D points not currently supported"); } try { NewPointOperation op = new NewPointOperation(); IEntity ent = entityTypeComboBox.SelectedEntityType; DisplayId did = (DisplayId)idComboBox.SelectedItem; FeatureId fid = (did == null ? null : did.CreateId()); op.Execute(m_Position, ent, fid); return(op.Point); } catch (Exception ex) { MessageBox.Show(ex.StackTrace, ex.Message); } return(null); }
/// <summary> /// Checks whether this server instance supports a feature. /// </summary> /// <param name="featureId">The id of the feature.</param> /// <returns>True if this server instance supports the feature; otherwise, false.</returns> public bool Supports(FeatureId featureId) { switch (featureId) { // supported in all versions case FeatureId.WriteOpcodes: return(true); // supported in 2.4.0 and newer case FeatureId.GeoJson: case FeatureId.TextSearchCommand: return(BuildInfo.Version >= new Version(2, 4, 0)); // supported in 2.6.0 and newer case FeatureId.AggregateAllowDiskUse: case FeatureId.AggregateCursor: case FeatureId.AggregateExplain: case FeatureId.AggregateOutputToCollection: case FeatureId.CreateIndexCommand: case FeatureId.MaxTime: case FeatureId.TextSearchQuery: case FeatureId.UserManagementCommands: case FeatureId.WriteCommands: return(BuildInfo.Version >= new Version(2, 6, 0)); // supported in 2.6.0 and newer but not on mongos case FeatureId.ParallelScanCommand: return(BuildInfo.Version >= new Version(2, 6, 0) && InstanceType != MongoServerInstanceType.ShardRouter); default: return(false); } }
/// <summary> /// Executes this operation. /// </summary> /// <param name="pointId">The ID and entity type for the intersect point</param> /// <param name="ent1">The entity type for 1st line (null for no line)</param> /// <param name="ent2">The entity type for 2nd line (null for no line)</param> internal void Execute(IdHandle pointId, IEntity ent1, IEntity ent2) { FeatureFactory ff = new FeatureFactory(this); FeatureId fid = pointId.CreateId(); IFeature x = new FeatureStub(this, pointId.Entity, fid); ff.AddFeatureDescription(DataField.To, x); if (ent1 != null) { // Lines are not allowed if the direction line is associated with an offset // distance (since we would then need to add a point at the start of the // direction line). This should have been trapped by the UI. Note that an // offset specified using an OffsetPoint is valid. if (m_Direction.Offset is OffsetDistance) { throw new ApplicationException("Cannot add direction line because a distance offset is involved"); } IFeature f = new FeatureStub(this, ent1, null); ff.AddFeatureDescription(DataField.DirLine, f); } if (ent2 != null) { IFeature f = new FeatureStub(this, ent2, null); ff.AddFeatureDescription(DataField.DistLine, f); } base.Execute(ff); /* * // Calculate the position of the point of intersection. * IPosition xsect = Calculate(m_Direction, m_Distance, m_From, m_Default); * if (xsect==null) * throw new Exception("Cannot calculate intersection point"); * * // Add the intersection point * m_To = AddIntersection(xsect, pointId); * * // If we have a defined entity types for lines, add them too. * CadastralMapModel map = MapModel; * * if (ent1!=null) * { * IPosition start = m_Direction.StartPosition; * PointFeature ps = map.EnsurePointExists(start, this); * m_DirLine = map.AddLine(ps, m_To, ent1, this); * } * * if (ent2!=null) * m_DistLine = map.AddLine(m_From, m_To, ent2, this); * * // Peform standard completion steps * Complete(); */ }
public Feature(string name, Point3D center, Direction3D direction, double size) { Id = new FeatureId(); Name = name; Center = center; Direction = direction; Size = size; }
public override int GetHashCode() { unchecked { int result = FeatureDescription?.GetHashCode() ?? 0; result = (result * 397) ^ (FeatureStatus?.GetHashCode() ?? 0); result = (result * 397) ^ (FeatureId?.GetHashCode() ?? 0); return(result); } }
public override int GetHashCode() { unchecked { int result = (FeatureDescription != null ? FeatureDescription.GetHashCode() : 0); result = (result * 397) ^ (FeatureStatus != null ? FeatureStatus.GetHashCode() : 0); result = (result * 397) ^ (FeatureId != null ? FeatureId.GetHashCode() : 0); return(result); } }
public override int GetHashCode() { unchecked { var hashCode = HashConstants.OffsetBasis; hashCode = (hashCode ^ (FeatureId.GetHashCode())) * HashConstants.Prime; hashCode = (hashCode ^ (MicroserviceId.GetHashCode())) * HashConstants.Prime; return(hashCode); } }
public TraceLogBlock(FeatureId featureId, FunctionId functionId, string message, int uniquePairId, CancellationToken cancellationToken) { this.featureId = featureId; this.functionId = functionId; this.uniquePairId = uniquePairId; this.cancellationToken = cancellationToken; this.watch = Stopwatch.StartNew(); Trace.WriteLine(string.Format("[{0}] Start({1}) : {2}/{3} - {4}", Thread.CurrentThread.ManagedThreadId, uniquePairId, featureId.ToString(), functionId.ToString(), message)); }
/// <summary> /// Checks whether this server instance supports a feature. /// </summary> /// <param name="featureId">The id of the feature.</param> /// <returns>True if this server instance supports the feature; otherwise, false.</returns> public bool Supports(FeatureId featureId) { FeatureSet featureSet; lock (_serverInstanceLock) { featureSet = _serverInfo.FeatureSet; } return(featureSet.IsSupported(featureId)); }
/// <summary> /// Creates basic information for a new feature that will be created by this edit. /// </summary> /// <param name="e">The entity type for the feature</param> /// <returns>Information for the new feature</returns> IFeature CreateFeatureDescription(IEntity e) { FeatureId fid = null; IdHandle h = new IdHandle(); if (h.ReserveId(e, 0)) { fid = h.CreateId(); } return(new FeatureStub(this, e, fid)); }
/// <summary> /// Takes the position object and converts it to an array of doubles /// </summary> /// <param name="writer"></param> /// <param name="value"></param> /// <param name="serializer"></param> public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { FeatureId id = (FeatureId)value; if (id.GetOriginalType() == typeof(string)) { writer.WriteValue(id.Value); } else { writer.WriteValue(Int64.Parse(id.Value)); } }
public IObservable <bool> IsFeatureEnabled(FeatureId featureId) { lock (this) { if (enabledFeatureObservables.TryGetValue((int)featureId, out var observable)) { return(observable); } var defaultFeatureObservable = new Observable <bool>(enabledFeatureIds.Contains((int)featureId)); enabledFeatureObservables[(int)featureId] = defaultFeatureObservable; return(defaultFeatureObservable); } }
/// <summary> /// Executes the new point operation. /// </summary> /// <param name="vtx">The position of the new point.</param> /// <param name="e">The entity type for the point (not null)</param> /// <param name="pointId">The ID to assign to the new point</param> internal void Execute(IPosition vtx, IEntity e, FeatureId pointId) { // Add a point on the model m_NewPoint = MapModel.AddPoint(vtx, e, this); // Give the new point the specified ID (point the ID to the feature & vice versa) if (pointId != null) { pointId.Add(m_NewPoint); } // Peform standard completion steps Complete(); }
/// <summary> /// Executes this operation. /// </summary> /// <param name="pointId">The key and entity type to assign to the intersection point.</param> internal void Execute(IdHandle pointId) { FeatureFactory ff = new FeatureFactory(this); FeatureId fid = pointId.CreateId(); IFeature x = new FeatureStub(this, pointId.Entity, fid); ff.AddFeatureDescription(DataField.To, x); if (m_IsSplit1) { // See FeatureFactory.MakeSection - the only thing that really matters is the // session sequence number that will get picked up by the FeatureStub constructor. ff.AddFeatureDescription(DataField.SplitBefore1, new FeatureStub(this, m_Line1.EntityType, null)); ff.AddFeatureDescription(DataField.SplitAfter1, new FeatureStub(this, m_Line1.EntityType, null)); } if (m_IsSplit2) { ff.AddFeatureDescription(DataField.SplitBefore2, new FeatureStub(this, m_Line2.EntityType, null)); ff.AddFeatureDescription(DataField.SplitAfter2, new FeatureStub(this, m_Line2.EntityType, null)); } base.Execute(ff); ////////// /* * // Calculate the position of the point of intersection. * IPosition xsect; * PointFeature closest; * if (!m_Line1.Intersect(m_Line2, m_CloseTo, out xsect, out closest)) * throw new Exception("Cannot calculate intersection point"); * * // Add the intersection point * m_Intersection = AddIntersection(xsect, pointId); * * // Are we splitting the input lines? If so, do it. * m_IsSplit1 = wantsplit1; * if (m_IsSplit1) * SplitLine(m_Intersection, m_Line1, out m_Line1a, out m_Line1b); * * m_IsSplit2 = wantsplit2; * if (m_IsSplit2) * SplitLine(m_Intersection, m_Line2, out m_Line2a, out m_Line2b); * * // Peform standard completion steps * Complete(); */ }
public List <KeyValuePair <string, string> > GetAsPropertyList() { return(new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>(nameof(DisplayName), DisplayName), new KeyValuePair <string, string>(nameof(FeatureId), FeatureId.ToString()), new KeyValuePair <string, string>(nameof(LocationId), LocationId.ToString()), new KeyValuePair <string, string>(nameof(Scope), Definition.Scope.ToString()), new KeyValuePair <string, string>(nameof(TimeActivated), TimeActivated.ToString()), new KeyValuePair <string, string>(nameof(Version), Version.ToString()), new KeyValuePair <string, string>(nameof(Faulty), Faulty.ToString()), new KeyValuePair <string, string>(nameof(SandBoxedSolutionLocation), SandBoxedSolutionLocation), new KeyValuePair <string, string>(nameof(Properties), Common.StringUtilities.PropertiesToString(Properties)) }); }
/// <summary> /// simplest way to log a start and end pair with a simple context message which should be very cheap to create /// </summary> public static IDisposable LogBlock(FeatureId featureId, FunctionId functionId, string message, CancellationToken token) { var logger = GetLogger(); if (logger == null) { return(EmptyLogBlock.Instance); } if (!logger.IsEnabled(featureId, functionId)) { return(EmptyLogBlock.Instance); } message = logger.IsVerbose() ? message : string.Empty; return(logger.LogBlock(featureId, functionId, message ?? string.Empty, GetNextUniqueBlockId(), token)); }
/// <summary> /// log a specific event with a simple context message which should be very cheap to create /// </summary> public static void Log(FeatureId featureId, FunctionId functionId, string message = null) { var logger = GetLogger(); if (logger == null) { return; } if (!logger.IsEnabled(featureId, functionId)) { return; } message = logger.IsVerbose() ? message : string.Empty; logger.Log(featureId, functionId, message ?? string.Empty); }
/// <summary> /// Executes this operation. /// </summary> /// <param name="pointId">The ID and entity type for the intersect point</param> /// <param name="ent1">The entity type for 1st line (null for no line)</param> /// <param name="ent2">The entity type for 2nd line (null for no line)</param> internal void Execute(IdHandle pointId, IEntity ent1, IEntity ent2) { FeatureFactory ff = new FeatureFactory(this); FeatureId fid = pointId.CreateId(); IFeature x = new FeatureStub(this, pointId.Entity, fid); ff.AddFeatureDescription(DataField.To, x); if (ent1 != null) { IFeature f = new FeatureStub(this, ent1, null); ff.AddFeatureDescription(DataField.Line1, f); } if (ent2 != null) { IFeature f = new FeatureStub(this, ent2, null); ff.AddFeatureDescription(DataField.Line2, f); } base.Execute(ff); /* * // Calculate the position of the point of intersection. * IPosition xsect = Calculate(m_Distance1, m_From1, m_Distance2, m_From2, m_Default); * if (xsect==null) * throw new Exception("Cannot calculate intersection point"); * * // Add the intersection point * m_To = AddIntersection(xsect, pointId); * * // If we have a defined entity types for lines, add them too. * CadastralMapModel map = MapModel; * * if (ent1!=null) * m_Line1 = map.AddLine(m_From1, m_To, ent1, this); * * if (ent2!=null) * m_Line2 = map.AddLine(m_From2, m_To, ent2, this); * * // Peform standard completion steps * Complete(); */ }
/// <summary> /// log a start and end pair with a context message that requires some arguments to be created when requested. /// given arguments will be passed to the messageGetter so that it can create the context message without requiring lifted locals /// </summary> public static IDisposable LogBlock <TArg0, TArg1, TArg2, TArg3>(FeatureId featureId, FunctionId functionId, Func <TArg0, TArg1, TArg2, TArg3, string> messageGetter, TArg0 arg0, TArg1 arg1, TArg2 arg2, TArg3 arg3, CancellationToken token) { var logger = GetLogger(); if (logger == null) { return(EmptyLogBlock.Instance); } if (!logger.IsEnabled(featureId, functionId)) { return(EmptyLogBlock.Instance); } var message = logger.IsVerbose() ? messageGetter(arg0, arg1, arg2, arg3) : string.Empty; return(logger.LogBlock(featureId, functionId, message, GetNextUniqueBlockId(), token)); }
/// <summary> /// log a specific event with a context message that requires some arguments to be created when requested. /// given arguments will be passed to the messageGetter so that it can create the context message without requiring lifted locals /// </summary> public static void Log <TArg>(FeatureId featureId, FunctionId functionId, Func <TArg, string> messageGetter, TArg arg) { var logger = GetLogger(); if (logger == null) { return; } if (!logger.IsEnabled(featureId, functionId)) { return; } var message = logger.IsVerbose() ? messageGetter(arg) : string.Empty; logger.Log(featureId, functionId, message); }
/// <summary> /// Checks whether this server instance supports a feature. /// </summary> /// <param name="featureId">The id of the feature.</param> /// <returns>True if this server instance supports the feature; otherwise, false.</returns> public bool Supports(FeatureId featureId) { switch (featureId) { // supported in all versions case FeatureId.WriteOpcodes: return true; // supported in 2.4.0 and newer case FeatureId.GeoJson: case FeatureId.TextSearchCommand: return BuildInfo.Version >= new Version(2, 4, 0); // supported in 2.6.0 and newer case FeatureId.AggregateAllowDiskUse: case FeatureId.AggregateCursor: case FeatureId.AggregateExplain: case FeatureId.AggregateOutputToCollection: case FeatureId.CreateIndexCommand: case FeatureId.MaxTime: case FeatureId.TextSearchQuery: case FeatureId.UserManagementCommands: case FeatureId.WriteCommands: return BuildInfo.Version >= new Version(2, 6, 0); // supported in 2.6.0 and newer but not on mongos case FeatureId.ParallelScanCommand: return BuildInfo.Version >= new Version(2, 6, 0) && InstanceType != MongoServerInstanceType.ShardRouter; default: return false; } }
public void Log(string message, FeatureId featureId, FunctionId functionId) { WriteEvent(1, message ?? string.Empty, (int)featureId, (int)functionId); }
public IDisposable LogBlock(FeatureId featureId, FunctionId functionId, string message, int uniquePairId, CancellationToken cancellationToken) { return EmptyLogBlock.Instance; }
public bool IsEnabled(FeatureId featureId, FunctionId functionId) { return false; }
/// <summary> /// Executes this operation. /// </summary> /// <param name="pointId">The ID (and entity type) for the extension point.</param> /// <param name="lineEnt">The entity type for the extension line (null for no line).</param> internal void Execute(IdHandle pointId, IEntity lineEnt) { FeatureFactory ff = new FeatureFactory(this); FeatureId fid = pointId.CreateId(); IFeature xp = new FeatureStub(this, pointId.Entity, fid); ff.AddFeatureDescription(DataField.NewPoint, xp); if (lineEnt != null) { IFeature f = new FeatureStub(this, lineEnt, null); ff.AddFeatureDescription(DataField.NewLine, f); } base.Execute(ff); /* * IPosition start; // Start of the extension * IPosition end; // End of the extension * * // See if the extension is a straight line. * bool isStraight = LineExtensionUI.Calculate(m_ExtendLine, m_IsExtendFromEnd, m_Length, out start, out end); * * // If it's not straight, it should be a circular arc. * bool isCurve = false; * IPosition center; // The centre of the circle * bool iscw = true; // Is the curve clockwise? * * if (!isStraight) * isCurve = LineExtensionUI.Calculate(m_ExtendLine, m_IsExtendFromEnd, m_Length, out start, out end, out center, out iscw); * * // Return if it's neither straight or a circular arc. * if ( !(isStraight || isCurve) ) * throw new Exception("Cannot calculate line extension point."); * * // Add the extension point to the map. * CadastralMapModel map = MapModel; * m_NewPoint = map.AddPoint(end, pointId.Entity, this); * * // Associate the new point with the specified ID (if any). * pointId.CreateId(m_NewPoint); * * // If a line entity has been supplied, add a line too. * if (lineEnt==null) * m_NewLine = null; * else * { * // Get the point at the end of the extension line * PointFeature s = (m_IsExtendFromEnd ? m_ExtendLine.EndPoint : m_ExtendLine.StartPoint); * * if (isStraight) * m_NewLine = map.AddLine(s, m_NewPoint, lineEnt, this); * else * { * // We need the circle that the arc lies on. * Circle circle = m_ExtendLine.Circle; * Debug.Assert(circle!=null); * * // Add the arc to the map. * m_NewLine = map.AddCircularArc(circle, s, m_NewPoint, iscw, lineEnt, this); * } * } * * // Peform standard completion steps * Complete(); */ }
// public methods /// <summary> /// Checks whether a feature is supported. /// </summary> /// <param name="featureId">The feature Id.</param> /// <returns>True if the feature is supported; otherwise, false.</returns> public bool IsSupported(FeatureId featureId) { return _features.Contains(featureId); }
// internal methods internal void AddFeature(FeatureId featureId) { _features.Add(featureId); }
// public methods /// <summary> /// Checks whether a feature is supported. /// </summary> /// <param name="featureId">The feature Id.</param> /// <returns>True if the feature is supported; otherwise, false.</returns> public bool IsSupported(FeatureId featureId) { return(_features.Contains(featureId)); }
public MeasurementSetKey(Feature feature, MeasurementSet measurementSet) { _featureId = feature.Id; _minimumPoints = measurementSet.MinimumPoints; _maximumPoints = measurementSet.MaximumPoints; }
public IDisposable LogBlock(FeatureId featureId, FunctionId functionId, string message, int blockId, CancellationToken cancellationToken) { var block = etwBlocksPool.Allocate(); block.Construct(functionId, message, blockId, cancellationToken); return block; }
public IDisposable LogBlock(FeatureId featureId, FunctionId functionId, string message, int uniquePairId, CancellationToken cancellationToken) { return new TraceLogBlock(featureId, functionId, message, uniquePairId, cancellationToken); }
public void Log(FeatureId featureId, FunctionId functionId, string message) { }
/// <summary> /// simplest way to log a start and end pair /// </summary> public static IDisposable LogBlock(FeatureId featureId, FunctionId functionId, CancellationToken token) { return(LogBlock(featureId, functionId, string.Empty, token)); }
public ITogglableFeature this[FeatureId id] => _features[id];
public static Option<bool> GetOption(FeatureId featureId) { return options.GetOrAdd(featureId, optionGetter); }
public bool IsEnabled(FeatureId featureId, FunctionId functionId) { return RoslynEventSource.Instance.IsEnabled() && (this.loggingChecker == null || this.loggingChecker(featureId, functionId)); }
public void Log(FeatureId featureId, FunctionId functionId, string message) { RoslynEventSource.Instance.Log(message, featureId, functionId); }
/// <summary> /// Executes the new point operation. /// </summary> /// <param name="vtx">The position of the new point.</param> /// <param name="e">The entity type for the point (not null)</param> /// <param name="pointId">The ID to assign to the new point</param> internal void Execute(IPosition vtx, IEntity e, FeatureId pointId) { // Add a point on the model m_NewPoint = MapModel.AddPoint(vtx, e, this); // Give the new point the specified ID (point the ID to the feature & vice versa) if (pointId != null) pointId.Add(m_NewPoint); // Peform standard completion steps Complete(); }
// constructors public FeatureDetector(FeatureId featureId, params IFeatureDependency[] dependencies) { _featureId = featureId; _dependencies = dependencies; }
private static bool GetDefaultValue(FeatureId id) { return id != FeatureId.Cache && id != FeatureId.WorkCoordinator && id != FeatureId.Simplifier && id != FeatureId.Recoverable; }
public bool IsEnabled(FeatureId featureId, FunctionId functionId) { return this.loggingChecker == null || this.loggingChecker(featureId, functionId); }
public void Log(FeatureId featureId, FunctionId functionId, string message) { Trace.WriteLine(string.Format("[{0}] {1}/{2} - {3}", Thread.CurrentThread.ManagedThreadId, featureId.ToString(), functionId.ToString(), message)); }