public override void ExtendDefinition(IDefinition definition) { // only applies to type definitions var typeDef = definition as ITypeDefinition; if (typeDef != null) typeDef.Namespace = ""; }
public override void Walk(IDefinition definition) { IList<Variable> list = new List<Variable>(); if (VersionCode == VersionCode.V1) { Messenger.Walk( VersionCode, Agent, GetCommunity, new ObjectIdentifier(definition.GetNumericalForm()), list, Timeout, WalkMode.WithinSubtree); } else { Messenger.BulkWalk( VersionCode, Agent, GetCommunity, new ObjectIdentifier(definition.GetNumericalForm()), list, Timeout, 10, WalkMode.WithinSubtree, null, null); } foreach (Variable v in list) { Logger.Info(v.ToString(Objects)); } }
public void AddShapes(VexObject vo, IDefinition def, Matrix m) { if (def.Name == "circleShape") { //Matrix m = orgInst.Transformations[0].Matrix; Point c = new Point(m.TranslateX, m.TranslateY); float r = m.ScaleX * 100 / 2; Shapes.Add(new CircleShape2D(def.Name, c, r)); } else if (def is Symbol) { //Matrix m = orgInst.Transformations[0].Matrix; AddShape(def.Name, (Symbol)def, m); } else if (def is Timeline) { foreach (Instance inst in ((Timeline)def).Instances) { IDefinition def2 = vo.Definitions[inst.DefinitionId]; if (def2 is Symbol && (def2.UserData & (int)DefinitionKind.OutlineStroke) != 0) { //todo: Symbol may have multiple Shapes, and only one/some are red outlines //Matrix m = inst.Transformations[0].Matrix; AddShape(def.Name, (Symbol)def2, inst.Transformations[0].Matrix); } } } }
private static IDefinition LoadDefinition(string type, string headerPath, string dataPath) { IDefinition result = null; FileStream fs = new FileStream(dataPath, FileMode.Open); XmlSerializer xs = null; switch (type) { case "DDW.Vex.Timeline": xs = new XmlSerializer(typeof(Vex.Timeline)); break; case "DDW.Vex.Symbol": xs = GetShapeSerializer(); break; case "DDW.Vex.Image": xs = new XmlSerializer(typeof(Vex.Image)); break; } if (xs != null) { result = (Vex.IDefinition)xs.Deserialize(fs); } fs.Close(); //load header if (result != null) { fs = new FileStream(headerPath, FileMode.OpenOrCreate); XmlTextReader r = new XmlTextReader(fs); r.WhitespaceHandling = WhitespaceHandling.None; r.ReadStartElement("Definition"); do { if (r.IsStartElement()) { switch (r.Name) { default: r.Read(); break; } } }while (r.Read()); r.Close(); fs.Close(); } return(result); }
private bool PrintDefinitionSourceLocations(IDefinition definition) { bool result = false; if (this.pdbReader != null) { foreach (var psLoc in this.pdbReader.GetPrimarySourceLocationsFor(definition.Locations)) { this.PrintSourceLocation(psLoc); result = true; } } return result; }
public override void ExtendDefinition(IDefinition definition) { // only applies to type definitions var typeDef = definition as ITypeDefinition; if (typeDef != null) { typeDef.Namespace = ""; } }
public void ReturnsCloneOfDefinitionOfParent_WhenMatchingDefinitionInParentAndNoMatchingDefinitionInTestee() { var definitionOfParent = CreateDefinition(); this.parent.AddDefinition(definitionOfParent); IDefinition definition = this.testee.FindInHierarchyAndCloneDefinition(new TestQuestion()); definition.Should().BeACloneOf(definitionOfParent); }
//------------------------------- public IEntity GetEntity(TreeNode node) { IDefinition def = GetDefinition(node); if (def != null) { return(def.Entity); } return(null); }
public FormTable(IDefinition def) { _definition = def; InitializeComponent(); cbColumnDisplay.SelectedIndex = 1; if (PlatformSupport.Platform == PlatformType.Windows) { Icon = Properties.Resources.x_office_spreadsheet; } }
internal IDefinition MapDefinition(IDefinition def) { var symbol = def as Symbol; if ((object)symbol != null) { return((IDefinition)this.symbols.Visit(symbol)); } return(this.defs.VisitDef(def)); }
public override void ExtendDefinition(IDefinition definition) { var memberDef = definition as IMemberDefinition; if (memberDef == null) return; // change property to field if (memberDef.MemberKind == MemberDefinitionKind.Property) memberDef.MemberKind = MemberDefinitionKind.Field; }
public FormTable(IDefinition def) { _definition = def; InitializeComponent(); cbColumnDisplay.SelectedIndex = 1; if (PlatformSupport.Platform == PlatformType.Windows) { Icon = Properties.Resources.x_office_spreadsheet; } }
private string GetViewName(DefinitionRegistry registry, IDefinition definition) { var definitionSystemName = definition.SystemName; if (ViewEngine.FindView(ViewContext, definitionSystemName, false).Success) { return(definitionSystemName); } return(GetDefaultViewName(registry, definition)); }
ContainSingleMarshalledIdentifierValue( this GenericCollectionAssertions <PersonIdentifierEntity> assertions, IDefinition definition, string marshalledValue, bool deleted) { return(assertions.ContainSingle( _ => _.Value == marshalledValue && _.TypeName == definition.SystemName && (deleted ? _.Deleted != null : _.Deleted == null))); }
/// <summary> /// Find a definition of a specific type /// </summary> /// <remarks>Throws an InvalidCastException if the type doesn't match</remarks> /// <typeparam name="T">Type of the entity to find</typeparam> /// <param name="id">Identifier of the entity to find</param> /// <returns>The entity to find</returns> public T FindDefinitionOfType <T>(UInt32 id) where T : class { IDefinition to_find = Find(id); T to_ret = to_find as T; if (to_ret == null) { throw new InvalidCastException("Unable to cast entity with id " + id.ToString() + " (of type " + to_find.GetType().ToString() + ") into " + typeof(T).ToString()); } return(to_ret); }
//-------------------------------------------------------- private void FillDicDefinitions(IDefinition def) { if (def.Name != null) { m_dicDefinitions[def.Name] = def; } foreach (IDefinition child in def.Children) { FillDicDefinitions(child); } }
public IDefinition getDefinition(String id) { IDefinition oRetval = null; if (_definitions.ContainsKey(id)) { oRetval = _definitions[id]; } return(oRetval); }
private void AddIdStringForDefinition(string idString, IDefinition definition) { Contract.Ensures(definitionsByStringId[idString].Contains(definition)); if (!definitionsByStringId.ContainsKey(idString)) { definitionsByStringId[idString] = new HashSet <IDefinition>(new DefinitionEqualityComparer()); } definitionsByStringId[idString].Add(definition); }
public DiffApiDefinition(IDefinition left, IDefinition right, DifferenceType difference, IList <DiffApiDefinition> children) { IDefinition representative = left ?? right; Name = GetName(representative); Definition = representative; Left = left; Right = right; Difference = difference; Children = new ReadOnlyCollection <DiffApiDefinition>(children); }
private Definition2D GetDefinition2D(Matrix m, IDefinition def) { Definition2D result = definitions.Find(d => d.DefinitionName == def.Name); if (result == null) { result = CreateDefinition2D(def); definitions.Add(result); } return(result); }
private void m_menuParcourir_Click(object sender, EventArgs e) { TreeNode node = m_mibTree.SelectedNode; IDefinition def = m_mibTree.GetDefinition(node); if (def != null) { m_wndListe.Init(def); m_slideListe.IsCollapse = false; } }
private Definition CreateExtraNodes(string module, string longParent) { string[] content = longParent.Split('.'); Definition node = Find(ExtractName(content[0])); uint[] rootId = node.GetNumericalForm(); uint[] all = new uint[content.Length + rootId.Length - 1]; for (int j = rootId.Length - 1; j >= 0; j--) { all[j] = rootId[j]; } // change all to numerical for (int i = 1; i < content.Length; i++) { uint value; bool numberFound = UInt32.TryParse(content[i], out value); int currentCursor = rootId.Length + i - 1; if (numberFound) { all[currentCursor] = value; node = Find(ExtractParent(all, currentCursor + 1)); if (node != null) { continue; } IDefinition subroot = Find(ExtractParent(all, currentCursor)); // if not, create Prefix node. IEntity prefix = new OidValueAssignment(module, subroot.Name + "_" + value.ToString(CultureInfo.InvariantCulture), subroot.Name, value); node = CreateSelf(prefix); AddToTable(node); } else { string self = content[i]; string parent = content[i - 1]; IEntity extra = new OidValueAssignment(module, ExtractName(self), ExtractName(parent), ExtractValue(self)); node = CreateSelf(extra); if (node != null) { AddToTable(node); all[currentCursor] = node.Value; } else { //Logger.InfoFormat(CultureInfo.InvariantCulture, "ignored {0} in module {1}", longParent, module); } } } return(node); }
/// <summary> /// Sets the parameters. /// </summary> /// <param name="definition">The definition.</param> public virtual void SetParameters(IDefinition definition) { ConflictPath = string.Empty; if (definition != null) { if (!modPatchCollectionService.IsPatchMod(definition.ModName)) { ConflictPath = modPatchCollectionService.ResolveFullDefinitionPath(definition); } } }
//------------------------------------------- private void FillAllDefs(List <IDefinition> allDefs, IDefinition definition) { if (definition == null) { return; } foreach (IDefinition child in definition.Children) { allDefs.Add(child); FillAllDefs(allDefs, child); } }
public static bool IsCompilerGeneratedOrIsInCompilerGeneratedClass(this IDefinition member) { if (member == null) { return(false); } if (member.IsCompilerGenerated()) { return(true); } return(IsCompilerGeneratedOrIsInCompilerGeneratedClass(member.DeclaringType)); }
static string getNextVariableName(List <IDefinition> exportDefinitons, IDefinition definition) { var count = exportDefinitons.Where(p => p.Id.Equals(definition.Id, StringComparison.OrdinalIgnoreCase)).Count() + 1; var name = $"{definition.Id}_{count}"; while (exportDefinitons.Any(p => p.Id.Equals(name, StringComparison.OrdinalIgnoreCase))) { count++; name = $"{definition.Id}_{count}"; } return(name); }
//---------------------------------------------------- public void SetCurrent(IDefinition definition) { if (definition != GetCurrent()) { while (m_listeDefinitions.Count() - 1 > m_nCurrentIndex) { m_listeDefinitions.RemoveAt(m_listeDefinitions.Count() - 1); } m_listeDefinitions.Add(definition); m_nCurrentIndex = m_listeDefinitions.Count - 1; } }
/// <summary> /// Gets the name of the lios file. /// </summary> /// <param name="definition">The definition.</param> /// <param name="fileName">Name of the file.</param> /// <param name="requestDiskFileName">if set to <c>true</c> [request disk file name].</param> /// <returns>System.String.</returns> protected virtual string GetLIOSFileName(IDefinition definition, string fileName, bool requestDiskFileName) { if (requestDiskFileName) { if (definition.ValueType == ValueType.OverwrittenObjectSingleFile) { return(Path.Combine(definition.ParentDirectory, $"{LIOSName}{fileName.GenerateValidFileName()}")); } return(Path.Combine(definition.ParentDirectory, $"{LIOSName}{definition.Order:D8}{fileName.GenerateValidFileName()}")); } return(Path.Combine(definition.ParentDirectory, $"{LIOSName}{fileName.GenerateValidFileName()}")); }
//------------------------------------------- public void Init(IDefinition root) { if (!m_bLockUpdate) { m_root = root; InitPath(); m_allDefs.Clear(); m_wndListe.Items.Clear(); FillAllDefs(root); Refill(); } }
//------------------------------------------- public static string CalcRubriqueChamp(IDefinition definition) { string strRubrique = ""; IDefinition parent = definition.ParentDefinition; while (parent != null) { strRubrique = parent.Name + "/" + strRubrique; parent = parent.ParentDefinition; } return(strRubrique); }
/// <summary> /// Sets the right. /// </summary> /// <param name="definition">The definition.</param> public void SetRight(IDefinition definition) { async Task parseImage() { var mutex = await leftImageLock.LockAsync(); var right = RightImage; if (definition != null) { RightImageInfo = string.Empty; RightImage = null; right?.Dispose(); RightHeight = RightWidth = 0; using var ms = await modService.GetImageStreamAsync(definition?.ModName, definition?.File); if (ms != null) { try { RightImage = new Bitmap(ms); var imageHeight = (RightImage?.PixelSize.Width).GetValueOrDefault(); var imageWidth = (RightImage?.PixelSize.Height).GetValueOrDefault(); var info = localizationManager.GetResource(LocalizationResources.Conflict_Solver.ImageInfo); RightImageInfo = Smart.Format(info, new { Width = imageWidth, Height = imageHeight }); RightHeight = imageHeight; RightWidth = imageWidth; } catch (Exception ex) { logger.Error(ex); RightImageInfo = string.Empty; RightImage = null; right?.Dispose(); RightHeight = RightWidth = 0; } } } else { RightImageInfo = string.Empty; RightImage = null; right?.Dispose(); RightHeight = RightWidth = 0; } await Task.Delay(10); mutex.Dispose(); } Task.Run(() => parseImage().ConfigureAwait(false)).ConfigureAwait(false); }
public override void ExtendDefinition(IDefinition definition) { var methodDef = definition as MethodDefinition; if (methodDef == null || methodDef.Symbol == null) return; if (methodDef.Symbol.ReducedFrom != null) { // use the original method symbol and force non static methodDef.Symbol = methodDef.Symbol.ReducedFrom; methodDef.Modifiers.IsStatic = false; } }
//------------------------------------------- private void InitPath() { StringBuilder bl = new StringBuilder(); IDefinition def = m_root; while (def != null) { bl.Insert(0, def.Name); bl.Insert(0, '/'); def = def.ParentDefinition; } m_txtPath.Text = bl.ToString(); }
private void m_wndListe_SelectedIndexChanged(object sender, EventArgs e) { if (m_wndListe.SelectedItems.Count == 1) { IDefinition def = m_wndListe.SelectedItems[0].Tag as IDefinition; if (def != null && MibNavigator != null) { m_bLockUpdate = true; MibNavigator.NavigateTo(def.ModuleName, def.Name); m_bLockUpdate = false; } } }
/// <summary> /// Generates the name of the localization file. /// </summary> /// <param name="definition">The definition.</param> /// <param name="fileName">Name of the file.</param> /// <returns>System.String.</returns> protected virtual string GenerateLocalizationFileName(IDefinition definition, string fileName) { if (definition.ParentDirectory.Contains(Shared.Constants.LocalizationReplaceDirectory, StringComparison.OrdinalIgnoreCase)) { var proposedFileName = Path.Combine(definition.ParentDirectory, $"{LIOSName}{fileName.GenerateValidFileName()}"); return(EnsureRuleEnforced(definition, proposedFileName, false)); } else { var proposedFileName = Path.Combine(definition.ParentDirectory, Shared.Constants.LocalizationReplaceDirectory, $"{LIOSName}{fileName.GenerateValidFileName()}"); return(EnsureRuleEnforced(definition, proposedFileName, false)); } }
public string GetString(IDefinition definition, int indentLevel = -1) { EnsureStringWriter(); _string.Clear(); if (indentLevel != -1) _stringWriter.SyntaxtWriter.IndentLevel = indentLevel; _stringWriter.WriteDeclaration(definition); return _string.ToString(); }
public IEnumerable<SyntaxToken> GetTokenList(IDefinition definition, int indentLevel = -1) { EnsureTokenWriter(); _tokenizer.ClearTokens(); if (indentLevel != -1) _tokenizer.IndentLevel = indentLevel; _tokenWriter.WriteDeclaration(definition); return _tokenizer.ToTokenList(); }
protected string GetDefinitionName(IDefinition def) { string result; if (def.Name != null && def.Name != "") { result = def.Name; } else { result = symbolPrefix + def.Id.ToString(); } return result; }
private static IEnumerable <string> GetCSharpDecalarationLines(IDefinition api) { string text = api.GetCSharpDeclaration(); using (var reader = new StringReader(text)) { string line; while ((line = reader.ReadLine()) != null) { yield return(line); } } }
/// <summary> /// Merges the specified definition into this instance. /// If specified, the strategy/aggregator of this instance is overridden. /// Expression provider sets are added. /// </summary> /// <param name="definition">The definition.</param> public void Merge(IDefinition definition) { var def = definition as Definition <TQuestion, TAnswer, TParameter, TExpressionResult>; this.Aggregator = def.Aggregator ?? this.Aggregator; this.Strategy = def.Strategy ?? this.Strategy; foreach (var expressionProvider in def.expressionProvidersSets) { this.expressionProvidersSets.Add(expressionProvider); } }
public DefinitionWithLocation(IDefinition definition, int startLine, int startColumn, int endLine, int endColumn) { Debug.Assert(startLine >= 0); Debug.Assert(startColumn >= 0); Debug.Assert(endLine >= 0); Debug.Assert(endColumn >= 0); this.Definition = definition; this.StartLine = (uint)startLine; this.StartColumn = (uint)startColumn; this.EndLine = (uint)endLine; this.EndColumn = (uint)endColumn; }
public override void ExtendDefinition(IDefinition definition) { var typeDef = definition as ContainerTypeDefinition; if (typeDef == null) return; // set to anonymous type view typeDef.TypeKind = TypeDefinitionKind.Anonymous; // set each property to render as a field foreach (var prop in typeDef.Properties) prop.MemberKind = MemberDefinitionKind.Field; }
public SearchResult(IDefinition definition, uint[] remaining) { if (definition == null) { throw new ArgumentNullException("definition"); } if (remaining == null) { throw new ArgumentNullException("remaining"); } Definition = definition; _remaining = remaining; }
public static Matrix GetTransformation(IDefinition def) { Matrix translation; if (def.Position.X == 0.0f && def.Position.Y == 0.0f && def.Position.Z == 0.0f) translation = Matrix.Identity; else translation = Matrix.CreateTranslation(-(def.Position.Z - Constant.MaxXY), -(def.Position.X - Constant.MaxXY), def.Position.Y); var rotation = Matrix.CreateRotationX(MathHelper.ToRadians(def.Rotation.Z))* Matrix.CreateRotationY(MathHelper.ToRadians(def.Rotation.X))*Matrix.CreateRotationZ(MathHelper.ToRadians(def.Rotation.Y + 180)); if (def.Scale < 1.0f || def.Scale > 1.0f) return (Matrix.CreateScale(def.Scale)*rotation)*translation; return rotation * translation; }
public void AddDefinition(IDefinition definition) { _definitions.Add(definition); if (definition is FragmentDefinition) { Fragments.Add((FragmentDefinition) definition); } else if (definition is Operation) { Operations.Add((Operation) definition); } else { throw new ExecutionError("Unhandled document definition"); } }
public SymbolChange GetChange(IDefinition def) { var symbol = def as ISymbol; if (symbol != null) { return GetChange(symbol); } // If the def existed in the previous generation, the def is unchanged // (although it may contain changed defs); otherwise, it was added. if (this.definitionMap.DefinitionExists(def)) { var typeDef = def as ITypeDefinition; return (typeDef != null) ? SymbolChange.ContainsChanges : SymbolChange.None; } return SymbolChange.Added; }
internal override void GetTable(IDefinition def) { IList<Variable> list = new List<Variable>(); int rows = Messenger.Walk(VersionCode, Agent, GetCommunity, new ObjectIdentifier(def.GetNumericalForm()), list, Timeout, WalkMode.WithinSubtree); // How many rows are there? if (rows > 0) { FormTable newTable = new FormTable(def); newTable.SetRows(rows); newTable.PopulateGrid(list); newTable.Show(); } else { foreach (Variable t in list) { Logger.Info(t.ToString()); } } }
public override void GenerateXamlPart(VexObject v, IDefinition def, out string xamlFileName) { this.v = v; this.Log = new StringBuilder(); xamlFileName = Directory.GetCurrentDirectory() + "/" + v.Name + "_" + def.Id + ".xaml"; xw = new XamlWriter(xamlFileName, Encoding.UTF8); xw.WriteComment(headerComment); #if(IS_TRIAL) // turn off watermarking for small files isWatermarking = true; xw.WriteComment(trialComment); if (v.Definitions.Count < 15) { isWatermarking = false; } #else isWatermarking = false; #endif xw.OpenHeaderTag(def.StrokeBounds.Size.Width, def.StrokeBounds.Size.Height, v.BackgroundColor); Dictionary<uint, IDefinition> defList = new Dictionary<uint, IDefinition>(); defList.Add(1, def); WriteDefinitions(defList, true, true); //WriteTimelineDefiniton(v.Root, true); // Write a rectangle to hold this shape Instance inst = new Instance(); inst.Name = instancePrefix + def.Id; inst.InstanceID = 1; inst.DefinitionId = def.Id; inst.Transformations.Add(new Transform(0, 1000, Matrix.Identitiy, 1, ColorTransform.Identity)); WriteInstance(def, inst); xw.CloseHeaderTag(); xw.Close(); }
private static DefinitionType DetermineType(string type, string name, IDefinition parent) { if (type == typeof(OidValueAssignment).ToString()) { return DefinitionType.OidValueAssignment; } if (type != typeof(ObjectType).ToString()) { return DefinitionType.Unknown; } if (name.EndsWith("Table", StringComparison.Ordinal)) { return DefinitionType.Table; } if (name.EndsWith("Entry", StringComparison.Ordinal)) { return DefinitionType.Entry; } return parent.Type == DefinitionType.Entry ? DefinitionType.Column : DefinitionType.Scalar; }
private Definition2D GetDefinition2D(Matrix m, IDefinition def) { Definition2D result = definitions.Find(d => d.DefinitionName == def.Name); if (result == null) { result = CreateDefinition2D(def); definitions.Add(result); } return result; }
private string AddSymbolImage(IDefinition sy) { string nm = (sy.Name == null) ? "sym_" + sy.Id.ToString() : sy.Name; string bmpPath = resourceFolder + @"\" + curVo.Name + @"\" + nm + ".png"; bmpPath = OutputDirectory + "/" + bmpPath; bmpPath = bmpPath.Replace('\\', '/'); if (!usedImages.ContainsKey(bmpPath)) { usedImages.Add(bmpPath, sy); } return bmpPath; }
public override void ExtendDefinition(IDefinition definition) { definition.Name = _name; }
/// <summary> /// Allocates an object that describes an edit to a compilation as being either the addition, deletion or modification of a definition. /// </summary> /// <param name="kind">The kind of edit that has been performed (addition, deletion or modification).</param> /// <param name="affectedDefinition">The definition that has been added, deleted or modified.</param> /// <param name="modifiedParent">The new version of the parent of the affected definition (see also this.OriginalParent). /// If the edit is an addition or modification, this.ModifiedParent is the actual parent of this.AffectedDefinition. /// If this.AffectedDefinition does not have a parent then this.ModifiedParent is the same as this.AffectedDefinition.</param> /// <param name="originalParent">The original parent of the affected definition (see also this.ModifiedParent). /// If the edit is a deletion, this.OriginalParent is the parent of this.AffectedDefinition. /// If this.AffectedDefinition does not have a parent then this.OriginalParent is the same as this.AffectedDefinition.</param> /// <param name="modifiedSourceDocument">The source document that is the result of the edit described by this edit instance.</param> /// <param name="originalSourceDocument">The source document that has been edited as described by this edit instance.</param> public EditDescriptor(EditEventKind kind, IDefinition affectedDefinition, IDefinition modifiedParent, IDefinition originalParent, ISourceDocument modifiedSourceDocument, ISourceDocument originalSourceDocument) //^ requires modifiedSourceDocument.IsUpdatedVersionOf(originalSourceDocument); { this.kind = kind; this.affectedDefinition = affectedDefinition; this.modifiedSourceDocument = modifiedSourceDocument; this.modifiedParent = modifiedParent; this.originalSourceDocument = originalSourceDocument; this.originalParent = originalParent; }
private Definition2D CreateDefinition2D(IDefinition def) { Definition2D result = new Definition2D(); result.Id = def.Id; result.DefinitionName = def.Name; // todo: get linkage names from export assests tags (in vex format) result.LinkageName = def.Name; result.Bounds = def.StrokeBounds; if (def is Timeline) { Timeline tlDef = (Timeline)def; result.FrameCount = tlDef.FrameCount; } else if (def is Symbol) { // Symbol instDef = (Symbol)def; // result.StartTime = (int)instDef.StartTime; // result.EndTime = (int)instDef.EndTime; ParseBodyImage(result, def); } return result; }
/// <summary> /// Extends a definition. /// </summary> /// <param name="definition">The target definition.</param> public virtual void ExtendDefinition(IDefinition definition) { }
private void ParseBodyImage(Definition2D b2d, IDefinition sy) { string bmpPath = AddSymbolImage(sy); }
private bool IsVex2DSymbol(IDefinition def) { bool result = false; if (def is Symbol) { List<Shape> shapes = ((Symbol)def).Shapes; foreach (Shape sh in shapes) { if (sh.IsV2DShape()) { result = true; def.UserData |= (int)DefinitionKind.OutlineStroke; break; } } } else if (def is Timeline) { for (int i = 0; i < ((Timeline)def).Instances.Count; i++) { IInstance inst = ((Timeline)def).Instances[i]; IDefinition def2 = curVo.Definitions[inst.DefinitionId]; result = def2 is Symbol ? IsVex2DSymbol(def2) : false; if (result) { break; } } } return result; }
private void EnsureDefinition(Instance inst, IDefinition def) { DefinitionKind dk = (DefinitionKind)def.UserData; bool addInst = (inst != null); Matrix m = (inst == null) ? Matrix.Identity : inst.Transformations[0].Matrix; if ((dk & DefinitionKind.Ignore) == 0) { if (((dk & DefinitionKind.JointMarker) != 0) && (inst != null)) { V2DJointKind jointKind = jointKindMap[jointKinds.IndexOf(def.Name)]; ParseJoint(jointKind, inst); } else if (((dk & DefinitionKind.ShapeMarker) != 0) && (inst != null)) { if (!parentStack.Peek().Definition.IsDefined) { parentStack.Peek().Definition.AddShapes(curVo, def, m); } } if ((dk & DefinitionKind.TextField) != 0) { Text txt = (Text)def; if (def.Name == null) { def.Name = "$tx_" + def.Id; } Definition2D d2d = GetTextDefinition(m, txt); if (txt.TextRuns.Count > 0 && !txt.TextRuns[0].isEditable) { AddSymbolImage(def); } if (addInst) { AddInstance(inst, def); } } if ((dk & DefinitionKind.Timeline) != 0) { Definition2D d2d = GetDefinition2D(m, def); Instance2D i2d; if (addInst) { i2d = AddInstance(inst, def); } else { i2d = CreateInstance2D(def); } parentStack.Push(i2d); ParseTimeline((Timeline)def); i2d.Definition.IsDefined = true; parentStack.Pop(); } if ((dk & DefinitionKind.Symbol) != 0) { // todo: this is just adding images //Body2D b2d = CreateBody2D(inst, def); if (def.Name == null) { def.Name = "$sym_" + def.Id; } Definition2D d2d = GetDefinition2D(m, def); AddSymbolImage(def); if (addInst) { AddInstance(inst, def); } } if ((dk & DefinitionKind.Vex2D) != 0) { Definition2D d2d = GetDefinition2D(m, def); if (!isDefined.Contains(def.Id)) { isDefined.Add(def.Id); d2d.AddShapes(curVo, def, m); //parentStack.Peek().Definition.AddShapes(curVo, def, m); } Instance2D i2d; if (addInst) { i2d = AddInstance(inst, def); } else { i2d = CreateInstance2D(def); } parentStack.Push(i2d); ParseTimeline((Timeline)def); i2d.Definition.IsDefined = true; parentStack.Pop(); } } if (!isDefined.Contains(def.Id)) { isDefined.Add(def.Id); } }
private Instance2D CreateInstance2D(IDefinition def) { //MatrixComponents mc = Matrix.Identitiy.GetMatrixComponents(); //Instance2D result = new Instance2D(def.Name, def.Name, mc.TranslateX, mc.TranslateY, (float)(mc.Rotation * Math.PI / 180), mc.ScaleX, mc.ScaleY); Instance2D result = new Instance2D(def.Name, def.Name, 0,0,0,1,1); result.Depth = 0; result.Transforms = new List<Transform>(); result.Transforms.Add(new Transform(0, 0, Matrix.Identity, 1, ColorTransform.Identity)); result.Definition = definitions.Find(d => d.Id == def.Id); result.StartFrame = 0; result.TotalFrames = 0; return result; }
private Instance2D CreateInstance2D(Instance inst, IDefinition def) { //MatrixComponents mc = inst.Transformations[0].Matrix.GetMatrixComponents(); //Instance2D result = new Instance2D(inst.Name, def.Name, mc.TranslateX, mc.TranslateY, (float)(mc.Rotation * Math.PI / 180), mc.ScaleX, mc.ScaleY); Instance2D result = new Instance2D(inst.Name, def.Name, 0,0,0,1,1); result.Depth = inst.Depth; result.Transforms = inst.Transformations; result.Definition = definitions.Find(d => d.Id == inst.DefinitionId); result.StartFrame = curVo.GetFrameFromMilliseconds(inst.StartTime); result.TotalFrames = curVo.GetFrameFromMilliseconds(inst.EndTime) - result.StartFrame - 1; // end frame is last ms of frame, so -1 return result; }