예제 #1
0
        public bool KnotDupl(ListPairInt infosKnotDupl)
        {
            if (infosKnotDupl==null)
            {
                throw new ExceptionGMath("Contour","KnotDupl","Null argument");
                //return false;
            }
            if (this.knots.Count<=1)
                return true;
        
            int numKnot=this.NumKnot;
            int pozKnotFirst=0;
            int shiftFirst=0;


            for (shiftFirst=0; shiftFirst<numKnot; shiftFirst++)
            {
                if (this.KnotByPoz(pozKnotFirst).Val==
                    this.KnotByPoz(this.PozPrev(pozKnotFirst)).Val)
                {
                    pozKnotFirst=this.PozPrev(pozKnotFirst);
                }
                else
                {
                    break;
                }
            }

            // all knots coincide with Kn(0)        
            if (shiftFirst==numKnot)
            {
                infosKnotDupl.Add(this.KnotByPoz(0).IndexKnot,numKnot);
                return true;
            }
            
            
            // not all knots coincide with Kn(0)
            int pozKnotStart=0;
            int pozKnotLast=this.PozPrev(pozKnotFirst);
            
            bool toBreak=false;
            while (!toBreak) // TODO: check
            {
                int pozKnotCur=pozKnotStart;
                int pozKnotNext=this.PozNext(pozKnotCur);
                toBreak=(pozKnotNext==pozKnotLast);

                int multiplicity=1;
                while (this.KnotByPoz(pozKnotCur).Val==
                    this.KnotByPoz(pozKnotNext).Val)
                {
                    pozKnotCur=pozKnotNext;
                    pozKnotNext=this.PozNext(pozKnotNext);
                    toBreak=toBreak||(pozKnotNext==pozKnotLast);
                    multiplicity++;
                }
                if ((pozKnotStart==0)&&((shiftFirst>0)||(multiplicity>1)))
                {
                    infosKnotDupl.Add(this.KnotByPoz(0).IndexKnot,multiplicity+shiftFirst);                        
                }
                else if (multiplicity>1)
                {
                    infosKnotDupl.Add(this.KnotByPoz(pozKnotStart).IndexKnot,multiplicity);
                }
                pozKnotStart=pozKnotNext;
            }
            return true;
        }
예제 #2
0
        public GErrComponentDupl(int indGlyphOwner, ListPairInt pairsIndGlyphComponent)
        {
            if (pairsIndGlyphComponent==null)
            {
                throw new ExceptionGlyph("GErrComponentDupl","GErrComponentDupl","Null argument");
            }
            // ValInfoBasic
            base.TypeBasic = ValInfoType.Error;
            base.Name = "GERR_COMPONENT_DUPL";
            base.ValueUser = null;
            base.NameFileErrs = GErrConsts.FILE_RES_GERR_STRINGS;
            base.NameAsmFileErrs = GErrConsts.ASM_RES_GERR_STRINGS;
            base.TagPrincipal = "glyf";

            // GErr
            base.indexGlyphOwner = indGlyphOwner;
            base.typeGlyph = GConsts.TypeGlyph.Composite;
            base.severity = GErr.TypeGErrSeverity.High;
            base.SetScope(GScope.TypeGScope._GGO_);

            // this
            this.pairsIndGlyphComponent=pairsIndGlyphComponent;
        }
예제 #3
0
 protected override void ClearFunc()
 {
     this.pairsIndGlyphComponent.Clear();
     this.pairsIndGlyphComponent=null;
 }
예제 #4
0
        public GErrKnotDupl(int indGlyphOwner, ListPairInt infosKnotDupl)
        {
            // ValInfoBasic
            base.TypeBasic = ValInfoType.Warning;
            base.Name = "GERR_KNOT_DUPL";
            base.ValueUser = null;
            base.NameFileErrs = GErrConsts.FILE_RES_GERR_STRINGS;
            base.NameAsmFileErrs = GErrConsts.ASM_RES_GERR_STRINGS;
            base.TagPrincipal = "glyf";
        
            // GErr
            base.indexGlyphOwner = indGlyphOwner;
            base.typeGlyph = GConsts.TypeGlyph.Simple;
            base.severity = GErr.TypeGErrSeverity.Middle;
            base.SetScope(GScope.TypeGScope._GGO_);

            // this
            this.infosKnotDupl = infosKnotDupl;
        }
예제 #5
0
 protected override void ClearFunc()
 {
     this.infosKnotDupl.Clear();
     this.infosKnotDupl=null;
 }
예제 #6
0
 protected override void ClearFunc()
 {
     this.pairsIndKnotStart.Clear();
     this.pairsIndKnotStart=null;
 }
예제 #7
0
 internal StatusGV.TypeStatusExec ValidateSimpContDupl(GErrList gerrlist)
 {
     if (this.outl==null)
     {
         //throw new ExceptionGlyph("Glyph","ValidateSimpContDupl",null);
         return StatusGV.TypeStatusExec.Aborted;
     }
     ListPairInt pairsIndKnotStart=new ListPairInt();
     for (int pozContA=0; pozContA<this.outl.NumCont-1; pozContA++)
     {
         Contour contA=this.outl.ContourByPoz(pozContA);
         for (int pozContB=pozContA+1; pozContB<this.outl.NumCont; pozContB++)
         {
             Contour contB=this.outl.ContourByPoz(pozContB);
             bool isDupl;
             if (!contA.AreDuplicated(contB, out isDupl))
             {
                 //throw new ExceptionGlyph("Glyph","ValidateSimpContDupl",null);
                 return StatusGV.TypeStatusExec.Aborted;
             }
             if (isDupl)
             {
                 pairsIndKnotStart.Add(this.outl.ContourByPoz(pozContA).IndKnotStart,
                     this.outl.ContourByPoz(pozContB).IndKnotStart);
             }
         }
     }
     if (pairsIndKnotStart.Count!=0)
     {
         GErr gerr=new GErrContDupl(this.index, pairsIndKnotStart);
         gerrlist.Add(gerr);
         //this.isOrientDefined=false;
     }
     return StatusGV.TypeStatusExec.Completed;
 }
예제 #8
0
 internal StatusGV.TypeStatusExec ValidateSimpKnotDupl(GErrList gerrlist)
 {
     ListPairInt infosKnotDupl=new ListPairInt();
     for (int pozCont=0; pozCont<this.outl.NumCont; pozCont++)
     {
         Contour cont=this.outl.ContourByPoz(pozCont);
         cont.KnotDupl(infosKnotDupl);
     }
     if (infosKnotDupl.Count!=0)
     {
         GErr gerr=new GErrKnotDupl(this.index, infosKnotDupl);
         gerrlist.Add(gerr);
     }
     return StatusGV.TypeStatusExec.Completed;
 }
예제 #9
0
 internal StatusGV.TypeStatusExec ValidateCompComponentDupl(GErrList gerrlist)
 {
     ListPairInt pairsIndComponentDupl=new ListPairInt();
 
     if ((this.comp==null)||(this.outl==null))
     {
         //throw new ExceptionGlyph("Glyph","ValidateCompComponentDupl",null);
         return StatusGV.TypeStatusExec.Aborted;
     }
     int numComponent=this.comp.NumComponent;
     for (int pozComponentA=0; pozComponentA<numComponent-1; pozComponentA++)
     {
         Component componentA=this.comp.ComponentByPoz(pozComponentA);
         for (int pozComponentB=pozComponentA+1; pozComponentB<numComponent; pozComponentB++)
         {
             ListInfoInters linters=new ListInfoInters();
             Component componentB=this.comp.ComponentByPoz(pozComponentB);
             bool areDuplicated;
             this.outl.AreDuplicatedComponents(componentA,componentB,out areDuplicated);
             if (areDuplicated)
             {
                 pairsIndComponentDupl.Add(componentA.IndexGlyphComponent,
                     componentB.IndexGlyphComponent);
             }
         }
     }
     if (pairsIndComponentDupl.Count!=0)
     {
         GErr gerr=new GErrComponentDupl(this.index, pairsIndComponentDupl);
         gerrlist.Add(gerr);
     }
     return StatusGV.TypeStatusExec.Completed;
 }
예제 #10
0
        public bool KnotDupl(ListPairInt infosKnotDupl)
        {
            if (infosKnotDupl == null)
            {
                throw new ExceptionGMath("Contour", "KnotDupl", "Null argument");
                //return false;
            }
            if (this.knots.Count <= 1)
            {
                return(true);
            }

            int numKnot      = this.NumKnot;
            int pozKnotFirst = 0;
            int shiftFirst   = 0;


            for (shiftFirst = 0; shiftFirst < numKnot; shiftFirst++)
            {
                if (this.KnotByPoz(pozKnotFirst).Val ==
                    this.KnotByPoz(this.PozPrev(pozKnotFirst)).Val)
                {
                    pozKnotFirst = this.PozPrev(pozKnotFirst);
                }
                else
                {
                    break;
                }
            }

            // all knots coincide with Kn(0)
            if (shiftFirst == numKnot)
            {
                infosKnotDupl.Add(this.KnotByPoz(0).IndexKnot, numKnot);
                return(true);
            }


            // not all knots coincide with Kn(0)
            int pozKnotStart = 0;
            int pozKnotLast  = this.PozPrev(pozKnotFirst);

            bool toBreak = false;

            while (!toBreak) // TODO: check
            {
                int pozKnotCur  = pozKnotStart;
                int pozKnotNext = this.PozNext(pozKnotCur);
                toBreak = (pozKnotNext == pozKnotLast);

                int multiplicity = 1;
                while (this.KnotByPoz(pozKnotCur).Val ==
                       this.KnotByPoz(pozKnotNext).Val)
                {
                    pozKnotCur  = pozKnotNext;
                    pozKnotNext = this.PozNext(pozKnotNext);
                    toBreak     = toBreak || (pozKnotNext == pozKnotLast);
                    multiplicity++;
                }
                if ((pozKnotStart == 0) && ((shiftFirst > 0) || (multiplicity > 1)))
                {
                    infosKnotDupl.Add(this.KnotByPoz(0).IndexKnot, multiplicity + shiftFirst);
                }
                else if (multiplicity > 1)
                {
                    infosKnotDupl.Add(this.KnotByPoz(pozKnotStart).IndexKnot, multiplicity);
                }
                pozKnotStart = pozKnotNext;
            }
            return(true);
        }