public ImageClasificationModel(ModelOptions options) { _options = options; Context = new MLContext(1); Context.Log += Context_Log; Input = options.Input; }
public RectangularCrossSection(ModelOptions modelOption, double x, double y, double depth) { //Position of the 2D rectangular section (Will remain fixed). CartesianPoint2D p = CartesianPoint2D.Origin(modelOption.Model); DirectionVector2D v = DirectionVector2D.UnitX(modelOption.Model); PlacementAxis2D postion = new PlacementAxis2D(modelOption.Model, p, v); RectangleProfile rectProfile = new RectangleProfile(modelOption.Model, x, y, Xbim.Ifc2x3.ProfileResource.IfcProfileTypeEnum.AREA, postion); //Local placement of the 3D definition shape of the column(Will remain fixed). CartesianPoint3D Expoint = CartesianPoint3D.Origin(modelOption.Model); DirectionVector3D exMain = DirectionVector3D.UnitZ(modelOption.Model); DirectionVector3D exReff = DirectionVector3D.UnitX(modelOption.Model); PlacementAxis3D Exaxis = new PlacementAxis3D(modelOption.Model, Expoint, exMain, exReff); DirectionVector3D extVec = DirectionVector3D.UnitZ(modelOption.Model); ExtrudedAreaSolid solid = new ExtrudedAreaSolid(modelOption.Model, depth, rectProfile, extVec, Exaxis); ShapeRepresentation representation = new ShapeRepresentation(modelOption.Model, modelOption.Environment.SubContext, new List <ExtrudedAreaSolid>() { solid }); ProductShape = new ProductionDefinitionShape(modelOption.Model, new List <ShapeRepresentation>() { representation }); //Local placement of the object placement of the column (This will be manipulated according to Autodesk Revit readings). CartesianPoint3D point = CartesianPoint3D.Origin(modelOption.Model); DirectionVector3D main = DirectionVector3D.UnitZ(modelOption.Model); DirectionVector3D reff = DirectionVector3D.UnitX(modelOption.Model); PlacementAxis3D axis = new PlacementAxis3D(modelOption.Model, point, main, reff); LocalPlacement placement = new LocalPlacement(modelOption.Model, modelOption.Environment.Stories.FirstOrDefault().LocalPlacement, axis); }
public void customize_property() { ModelOptions modelOptions = new ModelOptions(); modelOptions.Configure <TargetEntity>() .Member(m => m.Value) .Setter(Lambda( Parameter(typeof(TargetEntity), out Expression entity), Parameter(typeof(int), out Expression value), Parameter(typeof(IMapperContext), out Expression context), Block( Assign(Property(entity, nameof(TargetEntity.Value)), value), Call("Add", Field(entity, "_modified"), Constant(nameof(TargetEntity.Value))) ) )); Mapper mapper = new Mapper( Options.Create(modelOptions), new TypeMapFactory()); var result = mapper.Map <SourceEntity, TargetEntity>(new SourceEntity { Value = 2 }); bool contains = result.IsSet(nameof(TargetEntity.Value)); Assert.True(contains); }
static async Task RunModelsAsync(ModelOptions options) { var file = await OpenContainerAsync(options) as IModelContainer; await ProcessModelsAsync(options, file); Goodbye(); }
/// <summary> /// Create new instance. /// </summary> public TimedModelService(IServiceProvider serviceProvider, ILogger <TimedModelService> logger, IOptions <ModelOptions> options) { _servicesProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _options = options?.Value ?? throw new ArgumentNullException(nameof(options)); }
/// <summary> /// Constructor /// </summary> public Parameters(QueryBuilder pQuery, Model pModel) { _query = pQuery; _model = pModel; _settings = pModel.Settings; _source = pModel.DataSource; Data = new Dictionary<string, object>(); }
public DetachedDbContext(DbContextOptions options) : base(options) { ModelOptions modelOptions = new ModelOptions(); modelOptions.Conventions.Add(new IsEntityConvention(this)); OnMapperCreating(modelOptions); Mapper = new Mapper(Options.Create(modelOptions), new TypeMapFactory()); QueryProvider = new QueryProvider(Mapper); }
public ITypeOptions Create(ModelOptions options, Type type) { ITypeOptions result = null; if (type.IsDictionary(out Type keyType, out Type valueType) && keyType == typeof(string) && valueType == typeof(object)) { result = _typeOptions; } return(result); }
public void Apply(ModelOptions modelOptions, ClassTypeOptions typeOptions) { if (!typeOptions.Members.Any(m => m.IsKey)) { foreach (ClassMemberOptions memberOptions in typeOptions.Members) { if (memberOptions.Name == "Id") { memberOptions.IsKey = true; return; } } } }
public void customize_constructor() { ModelOptions modelOptions = new ModelOptions(); modelOptions.Configure <TargetEntity>().Constructor(c => new TargetEntity(1)); Mapper mapper = new Mapper( Options.Create(modelOptions), new TypeMapFactory()); var result = mapper.Map <SourceEntity, TargetEntity>(new SourceEntity { Value = 2 }); Assert.Equal(1, result.Id); Assert.Equal(2, result.Value); }
public bool IsBackReference( ModelOptions options, TypeMap typeMap, IMemberOptions memberOptions, out BackReferenceMap backReferenceMap) { bool result = false; backReferenceMap = null; ITypeOptions memberTypeOptions = options.GetTypeOptions(memberOptions.Type); if (typeMap.Parent != null) { if (typeMap.TargetOptions.IsEntity && (typeMap.Parent.TargetOptions.Type == memberTypeOptions.Type || typeMap.Parent.TargetOptions.Type == memberTypeOptions.ItemType)) { backReferenceMap = new BackReferenceMap { MemberOptions = memberOptions, MemberTypeOptions = options.GetTypeOptions(memberOptions.Type), Parent = typeMap.Parent }; result = true; } else if (typeMap.Parent.Parent != null && typeMap.Parent.TargetOptions.IsCollection && (typeMap.Parent.Parent.TargetOptions.Type == memberTypeOptions.Type || typeMap.Parent.Parent.TargetOptions.Type == memberTypeOptions.ItemType)) { backReferenceMap = new BackReferenceMap { MemberOptions = memberOptions, MemberTypeOptions = options.GetTypeOptions(memberOptions.Type), Parent = typeMap.Parent.Parent }; result = true; } } return(result); }
static async Task ProcessModelsAsync(ModelOptions options, IModelContainer container) { string dir = options.InputFile + ".models"; Directory.CreateDirectory(dir); for (int i = 0; i < container.ModelCount; i++) { var model = await container.GetModelAsync(i); WriteLine($"Found model #{i}; Extracting to OBJ..."); string filePath = Path.Combine(dir, $"model_{i}.obj"); using (var writer = File.CreateText(filePath)) { await model.WriteToOBJAsync(writer); } WriteLine($"Conversion successful! Wrote output to file: {filePath}", OutputImportance.Verbose); } }
public override void Apply(AggregationAttribute annotation, ModelOptions modelOptions, ClassTypeOptions typeOptions, ClassMemberOptions memberOptions) { memberOptions.Owned = false; }
protected virtual void OnMapperCreating(ModelOptions options) { }
public override void Apply(KeyAttribute annotation, ModelOptions modelOptions, ClassTypeOptions typeOptions, ClassMemberOptions memberOptions) { memberOptions.IsKey = true; }
public override void Apply(CompositionAttribute annotation, ModelOptions modelOptions, ClassTypeOptions typeOptions, ClassMemberOptions memberOptions) { memberOptions.Owned = true; }
public void Apply(Attribute annotation, ModelOptions modelOptions, ClassTypeOptions typeOptions, ClassMemberOptions memberOptions) { Apply((TAttribute)annotation, modelOptions, typeOptions, memberOptions); }
public abstract void Apply(TAttribute annotation, ModelOptions modelOptions, ClassTypeOptions typeOptions, ClassMemberOptions memberOptions);
static void Main(string[] args) { //CHANGE PATH HERE. string path = @"C:\Users\Scorias\Desktop\IFC trails"; var editor = new XbimEditorCredentials { ApplicationDevelopersName = "xBIM Team", ApplicationFullName = "xBIM Toolkit", ApplicationIdentifier = "xBIM", ApplicationVersion = "4.0", EditorsFamilyName = "MoSalah", EditorsGivenName = "sane", EditorsOrganisationName = "Independent" }; RevitSeeker seeker; string filename = "RF"; string filepath = @"C:\Users\Scorias\Desktop\IFC trails"; using (var stepModel = IfcStore.Open($"{filepath}\\{filename}.ifc")) { seeker = new RevitSeeker(stepModel); } using (IfcStore model = IfcStore.Create(editor, IfcSchemaVersion.Ifc2X3, XbimStoreType.InMemoryModel)) { using (var txn = model.BeginTransaction("Initialise Model")) { Environment env = Environment.Create(model); ModelOptions option = new ModelOptions(model, env); //Local placement of the main storey. LocalPlacement storeyPlacement = new LocalPlacement(model, env.Building.LocalPlacement, env.ProjectAxis); BuildingStorey storey = new BuildingStorey(model, "Story", storeyPlacement, IfcElementCompositionEnum.ELEMENT, 0); env.AddStorey(model, storey); //Assigning the material and the main column. Material material = new Material(model, "S235JR"); var RevitColumns = seeker.RevitColumns; List <TeklaPlate> StoryComponants = new List <TeklaPlate>(); TeklaPlatePlacementInitializer plateInitializer; foreach (var rColumn in RevitColumns) { List <RevitPlate> rColumnComp = rColumn.Components; foreach (var revitPlate in rColumnComp) { plateInitializer = new TeklaPlatePlacementInitializer(model, env, revitPlate.Origin, revitPlate.Axis, revitPlate.ReffDirection); TeklaPlate plate = new TeklaPlate(option, plateInitializer.LocalPlacement, revitPlate.OverallWidth, revitPlate.OverallDepth, revitPlate.Height); StoryComponants.Add(plate); plate.AssignMaterial(material); } } storey.AddModelObject(StoryComponants.ToArray()); txn.Commit(); } model.SaveAs($"{path}\\TheRealMindWurks.ifcxml"); } }
public PatchJsonConverterFactory(IOptions <ModelOptions> options) { _options = options.Value; }
public override void Apply(PatchAttribute annotation, ModelOptions modelOptions, ClassTypeOptions typeOptions, ClassMemberOptions memberOptions) { typeOptions.UsePatchProxy = true; }
protected override void OnMapperCreating(ModelOptions options) { }
public override void Apply(NotMappedAttribute annotation, ModelOptions modelOptions, ClassTypeOptions typeOptions, ClassMemberOptions memberOptions) { memberOptions.Ignored = true; }
public void Apply(ModelOptions modelOptions, ClassTypeOptions typeOptions) { typeOptions.IsEntity = _dbContext.Model.FindEntityType(typeOptions.Type) != null; }
public TypeMap Create(Mapper mapper, ModelOptions options, TypeMap parentMap, Type sourceType, Type targetType, bool owned) { TypeMap typeMap = new TypeMap(); typeMap.Parent = parentMap; typeMap.Mapper = mapper; typeMap.SourceOptions = options.GetTypeOptions(sourceType); typeMap.Source = Parameter(sourceType, "source_" + sourceType.Name); typeMap.TargetOptions = options.GetTypeOptions(targetType); typeMap.Target = Parameter(targetType, "target_" + targetType.Name); typeMap.Owned = owned; if (parentMap == null) { typeMap.Context = Parameter(typeof(IMapperContext), "context"); } else { typeMap.Context = parentMap.Context; } while (parentMap != null) { if (typeMap.TargetOptions == parentMap.TargetOptions && typeMap.SourceOptions == parentMap.SourceOptions && typeMap.Owned == parentMap.Owned) { return(parentMap); } parentMap = parentMap.Parent; } if (typeMap.TargetOptions.IsCollection) { Type sourceItemType = typeMap.SourceOptions.ItemType; Type targetItemType = typeMap.TargetOptions.ItemType; if (typeMap.SourceOptions.Type == typeof(object)) { sourceItemType = typeof(object); } typeMap.ItemMap = Create(mapper, options, typeMap, sourceItemType, targetItemType, owned); } else if (typeMap.TargetOptions.IsComplexType) { IEnumerable <string> memberNames = typeMap.TargetOptions.MemberNames; if (memberNames != null) { foreach (string memberName in memberNames) { IMemberOptions targetMemberOptions = typeMap.TargetOptions.GetMember(memberName); if (targetMemberOptions != null && targetMemberOptions.CanWrite && !targetMemberOptions.Ignored) { if (IsBackReference(options, typeMap, targetMemberOptions, out BackReferenceMap backRefMap)) { typeMap.BackReference = backRefMap; } else { IMemberOptions sourceMemberOptions = typeMap.SourceOptions.GetMember(memberName); if (sourceMemberOptions != null && sourceMemberOptions.CanRead && !sourceMemberOptions.Ignored) { MemberMap memberMap = new MemberMap(); memberMap.SourceOptions = sourceMemberOptions; memberMap.TargetOptions = targetMemberOptions; memberMap.TypeMap = Create( mapper, options, typeMap, memberMap.SourceOptions.Type, memberMap.TargetOptions.Type, targetMemberOptions.Owned); typeMap.Members.Add(memberMap); } } } } } } return(typeMap); }