protected void Add(object o, DataRow row, TestData test) { IObjectLabel l = o as IObjectLabel; ICategoryObject co = l.Object; string name = l.GetName(collection); if (co is global::Regression.AliasRegression) { test.AddRegression(name, (uint)row[3], collection); return; } if (o is IProperties) { object ob = (o as IProperties).Properties; if (ob.GetType().Equals(typeof(DataPerformer.UI.Labels.GraphLabel))) { /* DataPerformer.UI.Interfaces.IGraphLabel lab = ob as DataPerformer.UI.Labels.GraphLabel; * Tuple<Dictionary<string, Color>[], Dictionary<string, bool>[], * Dictionary<string, string>[], string[], int[]>[] data = null;// lab.Data; * Tuple<Dictionary<string, Color>[], Dictionary<string, bool>[], * Dictionary<string, string>[], string[], int[]> t = data[0]; * Dictionary<string, Color>[] d = t.Item1; * IEnumerable<string> keys = d[0].Keys; * DataPerformer.DataConsumer cons = co as DataPerformer.DataConsumer; * test.AddChart(name, cons.Start, cons.Step, cons.Steps, lab.Data[0].Item4[1], * keys.ToArray<string>(), collection);*/ return; } } onAdd(o, row, test); }
/// <summary> /// Creates a form for component properties editor /// </summary> /// <param name="comp">The component</param> /// <returns>The result form</returns> public override object CreateForm(INamedComponent comp) { if (comp is IObjectLabel) { IObjectLabel ol = comp as IObjectLabel; ICategoryObject obj = ol.Object; Camera camera = obj.GetSimpleObject <Camera>(); if (camera != null) { } if (obj is Motion6D.SerializablePosition) { Motion6D.Interfaces.IPosition p = obj as Motion6D.Interfaces.IPosition; object o = p.Parameters; if (o != null) { if (o is Motion6D.Interfaces.IVisible) { Motion6D.Interfaces.IVisible v = o as Motion6D.Interfaces.IVisible; object ob = factory.CreateForm(p, v); if (ob != null) { if (ob is Form) { Form f = ob as Form; return(f); } } } } } } return(null); }
private static IEnumerable <IMaintainableRefObject> GetDataFlows( ICategoryObject categoryObject, IEnumerable <ICategorisationObject> categorisations) { ISet <IMaintainableRefObject> returnSet = new HashSet <IMaintainableRefObject>(); /* foreach */ foreach (ICategorisationObject cat in categorisations) { if (cat.IsExternalReference.IsTrue) { continue; } if (cat.CategoryReference.TargetReference.EnumType == categoryObject.StructureType.EnumType) { var refId = cat.CategoryReference.IdentifiableIds.Last(); if (refId.Equals(categoryObject.Id)) { returnSet.Add(cat.StructureReference.MaintainableReference); } } } return(returnSet); }
/// <summary> /// Constructor /// </summary> /// <param name="operation">Operation</param> /// <param name="w">Width</param> public PanelUnary(IObjectOperation operation, int w) { Width = w; this.operation = operation; ICategoryObject o = operation as ICategoryObject; label = o.Object as IObjectLabel; PictureBox p = new PictureBox(); p.Image = NamedComponent.GetImage(label); int y = 10; int x = 10; p.Left = x; p.Top = y; Controls.Add(p); y += p.Height + 10; Label lab = new Label(); lab.Text = label.RootName; //NamedComponent.GetText(label) + ""; lab.Left = x; lab.Top = y; Controls.Add(lab); y += lab.Height + 10; cb.Top = y; cb.Left = x; Controls.Add(cb); y += cb.Height + 10; Height = y; }
void Fill(XElement element, IDictionary <string, object> dict, ICategoryObject categoryObject) { if (!(categoryObject is IAlias)) { return; } IAlias a = categoryObject as IAlias; string type = element.GetAttributeLocal(Simulink.Parser.Library.SimulinkXmlParser.BlockType); if (!aliases.ContainsKey(type)) { return; } Dictionary <string, string> d = aliases[type]; IList <string> an = a.AliasNames; foreach (string key in d.Keys) { string val = d[key]; if (!an.Contains(val)) { continue; } string attr = element.GetAttributeLocal(key); if (attr.Length == 0) { continue; } object ty = a.GetType(val); dict[val] = GetObject(ty, attr); } }
void IXmlObjectFactory.Create(XElement element, ref ICategoryObject categoryObject) { foreach (IXmlObjectFactory factory in factories) { factory.Create(element, ref categoryObject); } }
public CategorisationObjectBaseCore(ICategorisationObject categorisation0, ISdmxObjectRetrievalManager retMan) : base(categorisation0) { IMaintainableObject maint = retMan.GetMaintainable(categorisation0 .StructureReference); IMaintainableObject cs = retMan.GetMaintainable(categorisation0 .CategoryReference); /* foreach */ foreach (IIdentifiableObject ident in cs.IdentifiableComposites) { if (categorisation0.CategoryReference.IsMatch(ident)) { category = (ICategoryObject) ident; break; } } if (categorisation0.StructureReference.TargetReference.IsMaintainable && categorisation0.StructureReference.IsMatch(maint)) { structure = maint; } else { foreach (IIdentifiableObject ident1 in maint.IdentifiableComposites) { if (categorisation0.StructureReference.IsMatch(ident1)) { structure = ident1; break; } } } if (structure == null) { throw new ReferenceException(categorisation0.StructureReference); } if (category == null) { throw new ReferenceException(categorisation0.CategoryReference); } }
/// <summary> /// Creates object label from object /// </summary> /// <param name="obj">The object</param> /// <returns>The label</returns> public override IObjectLabelUI CreateLabel(ICategoryObject obj) { if (obj is IProperties) { IProperties p = obj as IProperties; object pr = p.Properties; if (pr != null) { if (pr is IObjectLabelUI) { return(pr as IObjectLabelUI); } } } Type t = obj.GetType(); if (t.Equals(typeof(ObjectsCollection))) { ObjectsCollection coll = obj as ObjectsCollection; if (coll.Type.Equals(typeof(Regression.AliasRegression))) { return((new DataPerformer.UI.Labels.FisherLabel()).CreateLabelUI(null, false)); } } return(CreateObjectLabel(t, "", null)); }
void Admissible(object l, ICategoryObject o, bool[] b) { if (o is SoundCollection) { b[0] = true; } }
/// <summary> /// Creates a form for component properties editor /// </summary> /// <param name="comp">The component</param> /// <returns>The result form</returns> public override object CreateForm(INamedComponent comp) { if (comp is IObjectLabel) { IObjectLabel lab = comp as IObjectLabel; // The object of component ICategoryObject obj = lab.Object; if (obj is Motion6D.SerializablePosition) { Motion6D.Interfaces.IPosition p = obj as Motion6D.Interfaces.IPosition; object o = p.Parameters; if (o != null) { if (o is Motion6D.PhysicalFieldBase) { return(new Motion6D.UI.Forms.FormField3D(lab, o as Motion6D.PhysicalField3D)); } if (o is PhysicalField.SphericalFieldWrapper) { return(new Motion6D.UI.FormSphericalMagnnetic(lab, o as PhysicalField.SphericalFieldWrapper)); } if (o is Motion6D.InertialSensorData) { return(new Motion6D.UI.FormInertialSystem(lab, o as Motion6D.InertialSensorData)); } } } if (obj is Motion6D.InertialReferenceFrame) { return(new Motion6D.UI.FormInertia(lab)); } if (obj is Motion6D.ReferenceFrameData) { return(new Motion6D.UI.Forms.FormFrameData(lab)); } if (obj is Motion6D.RigidReferenceFrame) { return(new Motion6D.UI.Forms.FormRigidFrame(lab)); } if (obj is Motion6D.AcceleratedPosition) { return(new Motion6D.UI.FormAcceleratedPoint(lab)); } if (obj is Motion6D.PositionCollectionData) { return(new FormPointsCollection(lab)); } } if (comp is IArrowLabel) { IArrowLabel l = comp as IArrowLabel; ICategoryArrow arrow = l.Arrow; if (arrow is MechanicalAggregateLink) { return(new FormAggregateLink(l)); } } return(null); }
/// <summary> /// Sets associated labels /// </summary> /// <param name="c">Collection of labels</param> static public void SetLabels(IEnumerable <IObjectLabel> c) { foreach (IObjectLabel l in c) { ICategoryObject o = l.Object; o.SetAssociatedObject(l); } }
void IRemovableObject.RemoveObject() { if ((source != null) & (target != null)) { source.Remove(target); source = null; target = null; } }
/// <summary> /// Creates object label from object /// </summary> /// <param name="obj">The object</param> /// <returns>The label</returns> public override IObjectLabelUI CreateLabel(ICategoryObject obj) { if (obj is BitmapConsumer.IBitmapProvider) { return((new Labels.BitmapProviderLabel( ResourceImage.SourceBitmap.ToBitmap())).CreateLabelUI(null, false)); } return(null); }
ICategoryObject IObjectFactory.this[string name] { get { Type t = dic[name]; ConstructorInfo c = t.GetConstructor(new Type[0]); ICategoryObject co = c.Invoke(new object[0]) as ICategoryObject; return(co); } }
void CompleteSource(ICategoryObject obj) { ICategoryArrow[] arr = obj.GetTargetArrows <DataLink>(); foreach (ICategoryArrow a in arr) { ICategoryObject o = a.Source; CompletePost(o); CompleteSource(o); } }
/// <summary> /// Removes itself /// </summary> /// <param name="formRemove">The "should remove properties editor" flag</param> public virtual void Remove(bool formRemove) { Desktop.Remove(this); if (formRemove) { RemoveForm(); } theObject = null; GC.Collect(); }
private void setOperationNames(Dictionary <int, IOperationAcceptor> table) { operationNames.Clear(); foreach (int i in table.Keys) { ICategoryObject o = table[i] as ICategoryObject; IObjectLabel l = o.Object as IObjectLabel; operationNames[i] = this.GetRelativeName(o); } }
public override void Create(XElement element, ref ICategoryObject categoryObject) { if (!(categoryObject is T)) { return; } this.element = element; obj = categoryObject as T; Process(); }
/// <summary> /// Creates object label from object /// </summary> /// <param name="obj">The object</param> /// <returns>The label</returns> public override IObjectLabelUI CreateLabel(ICategoryObject obj) { if (obj is LogIterator) { LogIterator iterator = obj as LogIterator; Labels.LogIteratorLabel l = new Labels.LogIteratorLabel(); l.Object = obj; return(l.CreateLabelUI(Properties.Resources.logIterator.ToBitmap(), false)); } return(null); }
/// <summary> /// The post load operation /// </summary> public override bool PostLoad() { //return base.PostLoad(); if (!isLoaded) { return(false); } if (isPostLoaded) { return(true); } desktop.SetObjectNames(); PureObjectLabel.SetLabels(desktop.Objects); PureArrowLabel.SetLabels(desktop.Arrows); IEnumerable <IArrowLabel> arrows = desktop.Arrows; // SetParents(desktop); IEnumerable <object> components = desktop.Components; foreach (INamedComponent nc in components) { nc.Desktop = desktop; //nc.Parent = Object as INamedComponent; if (nc is IObjectLabel) { IObjectLabel ol = nc as IObjectLabel; if (ol.Object is IObjectContainer) { IObjectContainer oc = ol.Object as IObjectContainer; bool b = oc.PostLoad(); if (!b) { return(false); } } } } foreach (IArrowLabel arrow in arrows) { arrow.Desktop = desktop; ICategoryObject source = arrow.Arrow.Source; if (source == null) { arrow.Arrow.Source = arrow.Source.Object; } ICategoryObject target = arrow.Arrow.Target; if (target == null) { arrow.Arrow.Target = arrow.Target.Object; } IAssociatedObject ass = arrow.Arrow as IAssociatedObject; ass.Object = arrow; } return(true); }
internal TextObject(ICategoryObject co) { if (co is CSharpSimulinkProxy) { csproxy = co as CSharpSimulinkProxy; } else { container = co as SimulinkContainer; } }
/// <summary> /// Sets control of the object /// </summary> /// <param name="categoryObject">The object</param> /// <param name="control">The control</param> /// <returns>True in case of succces and false otherwise</returns> static public bool SetControl(this ICategoryObject categoryObject, Control control) { IUIFactory factory = StaticExtensionDiagramUIFactory.UIFactory; IObjectLabelUI label = factory.CreateLabel(categoryObject); if (label == null) { return(false); } label.SetControl(control); return(true); }
/// <summary> /// Creates object from Xml element /// </summary> /// <param name="type">Strig repesentaqtion of object type</param> /// <param name="element">Xml element</param> /// <returns>Created object</returns> public override ICategoryObject Create(string type, XElement element) { foreach (AbstractXmlCreateObjectFactory factory in factories) { ICategoryObject co = factory.Create(type, element); if (co != null) { return(co); } } return(null); }
/// <summary> /// Deserialization constructor /// </summary> /// <param name="info">Serialization info</param> /// <param name="context">Streaming context</param> public ObjectLabel(SerializationInfo info, StreamingContext context) : base(info, context) { Left = (int)info.GetValue("Left", typeof(int)); Top = (int)info.GetValue("Top", typeof(int)); theObject = (ICategoryObject)info.GetValue("Object", typeof(object)); if (true) { IAssociatedObject obj = theObject as IAssociatedObject; SetOwnName(); obj.SetAssociatedObject(this); } }
/// <summary> /// Returns the referenced category primary key. If the category does not exist it will be added. /// </summary> /// <param name="state"> /// The state. /// </param> /// <param name="maintainable"> /// The maintainable. /// </param> /// <param name="categoryScheme"> /// The category scheme. /// </param> /// <returns> /// The <see cref="ItemStatus"/>. /// </returns> private ItemStatus GetCategoryPrimaryKey(DbTransactionState state, ICategorisationObject maintainable, ItemSchemeFinalStatus categoryScheme) { ItemStatus categoryPrimaryKey; if (!categoryScheme.ItemIdMap.TryGetValue(maintainable.CategoryReference.ChildReference.Id, out categoryPrimaryKey)) { ICategoryObject categoryObject = this._categoryBuilder.Build(maintainable.CategoryReference); var primaryKey = this._categoryImport.Insert(state, new[] { categoryObject }, categoryScheme.FinalStatus.PrimaryKey).FirstOrDefault(); categoryPrimaryKey = new ItemStatus(categoryObject.Id, primaryKey); } return(categoryPrimaryKey); }
/// <summary> /// Gets name of object /// </summary> /// <param name="factory">Factory</param> /// <param name="obj">Object</param> /// <returns>Name of object</returns> public static string GetName(IXmlObjectFactory factory, ICategoryObject obj) { IDictionary <string, ICategoryObject> d = factory.Dictionary; foreach (string key in d.Keys) { if (d[key] == obj) { return(key); } } return(null); }
/// <summary> /// Creates objects /// </summary> /// <param name="element">XmlElement</param> /// <param name="categoryObject">Object</param> public override void Create(XElement element, ref ICategoryObject categoryObject) { factory.Create(element, ref categoryObject); if (categoryObject == null) { return; } string name = AbstractXmlCreateObjectFactory.GetName(factory, categoryObject); INamedComponent nc = categoryObject.Object as INamedComponent; PureObjectLabelPeer ol = new PureObjectLabelPeer(name, nc.Kind, categoryObject.GetType().FullName, 0, 0); desktop.AddObjectLabel(ol, categoryObject, true); }
public override object CreateForm(INamedComponent comp) { if (comp is IObjectLabel) { IObjectLabel lab = comp as IObjectLabel; ICategoryObject obj = lab.Object; if (obj is BitmapGraphSelection) { return(new Forms.FormBitmapGraphSelection(lab)); } } return(null); }
IMeasurements IDataLinkFactory.GetMeasurements(ICategoryObject target) { IAssociatedObject ao = target; object o = ao.Object; if (o is INamedComponent) { IMeasurements ml = null; INamedComponent comp = o as INamedComponent; IDesktop d = null; INamedComponent r = comp.Root; if (r != null) { d = r.Desktop; } else { d = comp.Desktop; } if (d != null) { d.ForEach((DataLink dl) => { if (ml != null) { return; } object dt = dl.Target; if (dt is IAssociatedObject) { IAssociatedObject aot = dt as IAssociatedObject; if (aot.Object == o & (!(aot is IChildrenObject))) { ml = dl.Target as IMeasurements; } } }); if (ml != null) { return(ml); } } } IMeasurements m = MeasurementsWrapper.Create(target); if (m == null) { CategoryException.ThrowIllegalTargetException(); } return(m); }
static private ITimeMeasureProvider GetProvider(DigraphPath path) { ITimeMeasureProvider p = null; for (int i = 0; i < path.Count - 1; i++) { ICategoryObject ob = path[i].CategoryObject; if (ob is ITimeMeasureProvider) { p = ob as ITimeMeasureProvider; } } return(p); }
private ICategoryObject GetObject(ICategoryObject obj) { if (obj is RelativeMeasurements) { return(obj); } IPosition p = obj.GetObject <IPosition>(); if (p != null) { return(p as ICategoryObject); } throw new Exception("Illegal type"); }
/// <summary> /// Initializes a new instance of the <see cref="CategoryMutableCore"/> class. /// </summary> /// <param name="objTarget"> /// The obj target. /// </param> public CategoryMutableCore(ICategoryObject objTarget) : base(objTarget) { this._categories = new List<ICategoryMutableObject>(); // make into mutable category beans if (objTarget.Items != null) { this._categories = new List<ICategoryMutableObject>(); foreach (ICategoryObject category in objTarget.Items) { this.AddItem(new CategoryMutableCore(category)); } } }
private static IEnumerable<IMaintainableRefObject> GetDataFlows( ICategoryObject categoryObject, IEnumerable<ICategorisationObject> categorisations) { ISet<IMaintainableRefObject> returnSet = new HashSet<IMaintainableRefObject>(); /* foreach */ foreach (ICategorisationObject cat in categorisations) { if (cat.IsExternalReference.IsTrue) { continue; } if (cat.CategoryReference.TargetReference.EnumType == categoryObject.StructureType.EnumType) { var refId = cat.CategoryReference.IdentifiableIds.Last(); if (refId.Equals(categoryObject.Id)) { returnSet.Add(cat.StructureReference.MaintainableReference); } } } return returnSet; }
private void FillArtefacts(TreeNode tn, ICategoryObject cat) { var foundedCat = _sdmxCS.Categorisations.Where(c => c.CategoryReference.IdentifiableIds[0] == cat.Id); string artefactType; ISdmxObjects sdmxObject; ArtefactIdentity ai; foreach (ICategorisationObject catObj in foundedCat) { artefactType = catObj.StructureReference.MaintainableStructureEnumType.EnumType.ToString(); if (_lVisibleArtefacts.Where(c => c.Contains(artefactType.ToUpper())).FirstOrDefault() != null) { ai = new ArtefactIdentity(catObj.StructureReference.MaintainableId, catObj.StructureReference.AgencyId, catObj.StructureReference.Version); sdmxObject = GetSdmxObjectArtefact(artefactType, ai); TreeNode tnArt = new TreeNode(" " + GetArtefactName(sdmxObject)); tnArt.Text += String.Format(" [{0},{1},{2}]", ai.ID, ai.Agency, ai.Version); tnArt.ToolTip = string.Format("ID: {0}\n\rAgency: {1}\n\rVersion: {2}", ai.ID, ai.Agency, ai.Version); tnArt.Value = artefactType + "|" + ai.ToString(); tnArt.ImageUrl = @"./images/" + artefactType + ".png"; tn.ChildNodes.Add(tnArt); ExpandToRoot(tnArt); } } }
private void CreateTreeWithRecursion(ICategoryObject category, TreeNode node) { LocalizedUtils localUtils = new LocalizedUtils(Utils.LocalizedCulture); if (category.Items.Count != 0) { int counter = 0; foreach (var subCategory in category.Items) { TreeNode tmpNode = new TreeNode(string.Format("[ {0} ] {1}", subCategory.Id, localUtils.GetNameableName(subCategory))); tmpNode.Value = subCategory.Id; tmpNode.SelectAction = TreeNodeSelectAction.Select; node.ChildNodes.Add(tmpNode); CreateTreeWithRecursion(subCategory, node.ChildNodes[counter]); counter++; } } else { //node.ChildNodes.Add( new TreeNode( category.Id ) ); return; } }
/// <summary> /// Create a Category Node /// </summary> /// <param name="category"> /// The SDMX Model category object /// </param> /// <param name="categoryCount"> /// The caregory counter. This methods updates it /// </param> /// <returns> /// The Category Node /// </returns> private static JsTreeNode CreateCategoryNode(ICategoryObject category, ref int categoryCount) { var categoryNode = new JsTreeNode(); // categoryNode.data.attributes["rel"] = category.Id; // categoryNode.SetId(category.Id); categoryNode.SetId( string.Format( CultureInfo.InvariantCulture, CategoryIdFormat, categoryCount.ToString("x", CultureInfo.InvariantCulture))); categoryCount++; SetupNode(categoryNode, category); categoryNode.SetRel("category"); return categoryNode; }
private void GetCategoryParent(ref List<Category> lCategory, ICategoryObject categoryObject) { foreach (ICategoryObject category in categoryObject.Items) { lCategory.Add(new Category(category.Id, category.Name, category.Description, category.IdentifiableParent.Id)); GetCategoryParent(ref lCategory, category); } }
private void GetCategoryParent(ref DataTable dt, ICategoryObject categoryObject) { foreach (ICategoryObject category in categoryObject.Items) { dt.Rows.Add(category.Id, category.Name, category.IdentifiableParent.Id); GetCategoryParent(ref dt, category); } }
/// <summary> /// Create Categorisations from Version 2.0 category, adds the categorisation to the sdmxObjects container /// </summary> /// <param name="beans"> /// container to add to /// </param> /// <param name="categoryType"> /// The category Type. /// </param> /// <param name="categoryBean"> /// The category Bean. /// </param> protected internal void ProcessCategory( ISdmxObjects beans, CategoryType categoryType, ICategoryObject categoryBean) { if (categoryType.DataflowRef != null) { foreach (DataflowRefType dataflowRefType in categoryType.DataflowRef) { // use mutable for now until the following issue is fixed. // http://www.metadatatechnology.com/mantis/view.php?id=1341 ICategorisationMutableObject mutable = new CategorisationMutableCore(); mutable.AgencyId = categoryBean.MaintainableParent.AgencyId; mutable.CategoryReference = categoryBean.AsReference; // TODO create specialized collections for TextTypeWrapperMutable and TextTypeWrapper foreach (ITextTypeWrapper name in categoryBean.Names) { mutable.Names.Add(new TextTypeWrapperMutableCore(name)); } mutable.StructureReference = dataflowRefType.URN != null ? new StructureReferenceImpl(dataflowRefType.URN) : new StructureReferenceImpl( dataflowRefType.AgencyID, dataflowRefType.DataflowID, dataflowRefType.Version, SdmxStructureEnumType.Dataflow); mutable.Id = string.Format( CultureInfo.InvariantCulture, "{0}_{1}", mutable.CategoryReference.GetHashCode(), mutable.StructureReference.GetHashCode()); // TODO use MT fix in java when is done. Mantis ticket: // http://www.metadatatechnology.com/mantis/view.php?id=1341 // sdmxObjects.AddCategorisation(new CategorisationObjectCore(categoryBean, dataflowRefType)); beans.AddCategorisation(new CategorisationObjectCore(mutable)); } } if (categoryType.MetadataflowRef != null) { foreach (var mdfRef in categoryType.MetadataflowRef) { beans.AddCategorisation(new CategorisationObjectCore(categoryBean, mdfRef)); } } }
private void RecursiveOnItems( ICategoryObject code, ref DataTable dt ) { LocalizedUtils localizedUtils = new LocalizedUtils(Utils.LocalizedCulture); string completeSequence = code.Parent.ToString().Split( '=' )[1].Split( ')' )[1]; if ( !completeSequence.Equals( string.Empty ) ) { completeSequence = completeSequence.Remove( 0, 1 ); } dt.Rows.Add(code.Id, localizedUtils.GetNameableName(code), localizedUtils.GetNameableDescription( code ), completeSequence ); if ( code.Items.Count != 0 ) { foreach ( ICategoryObject subCode in code.Items ) { RecursiveOnItems( subCode, ref dt ); } return; } else { return; } }