Exemplo n.º 1
0
        public static Bird CreateBird(BirdSpecies Species)
        {
            Bird animalObj = null;//Birdtype unknown at this time.


            //Lets determine users choice of animal.
            switch (Species)
            {
            case BirdSpecies.Crow:
                animalObj = new Crow();
                break;

            case BirdSpecies.Eagle:
                animalObj = new Eagle();
                break;

            case BirdSpecies.Penguin:
                animalObj = new Penguin();
                break;

            default:
                Debug.Assert(false, "Not implemented");
                break;
            }

            //Set animal category
            animalObj.Category = CategoryType.Bird;

            return(animalObj);//Return created instance of object.
        }
Exemplo n.º 2
0
        public void TestBirdCannotFlyWithFrozenWing()
        {
            var eagleWithOneFrozenWing = new Eagle(Gender.Female);
            eagleWithOneFrozenWing.Wings[0].Frozen = true;

            Assert.IsFalse(eagleWithOneFrozenWing.IsAbleToFly);
        }
    //트리거 관련 함수
    void OnTriggerEnter2D(Collider2D coll)
    {
        //까마귀에 닿았을때
        if (coll.gameObject.tag == "enemy_crow" && isUnbeat == false)
        {
            //트리거 들어온 적의 스크립트 가져오기
            Eagle = coll.gameObject.GetComponent <Eagle>();

            //방어시
            if (isBlock)
            {
                //(움직이는 값 (현 플레이어 위치 - 적 데미지 + 플레이어 방어력, 길이)
                Debug.Log("방어성공");
                this.transform.DOMoveX((this.transform.position.x - Eagle.eagle_damage - Eagle.eagle_damage + player_defense), 0.5f);
            }
            //방어 실패시
            else if (!isBlock)
            {
                Debug.Log("피격");
                this.transform.DOMoveX((this.transform.position.x - Eagle.eagle_damage), 0.5f);
            }

            //까마귀 공격 판정 함수 호출
            Eagle.player_hit();
        }
    }
Exemplo n.º 4
0
        public void EagleCanFlap()
        {
            Eagle  testEagle   = new Eagle();
            string testMessage = testEagle.Flap();

            Assert.Equal("The eagle spreads its wings.", testMessage);
        }
Exemplo n.º 5
0
        //******************************************FORM LOAD****************************************************************
        private void Form1_Load(object sender, EventArgs e)
        {
            Random rand = new Random();
            //Instanciate Animal objects
            Eagle    vulture      = new Eagle(15, "Animal_Pictures/Vulture.jpg", "Animal_Sounds/vulture.wav", rand.Next(1000, 10000).ToString());
            Lion     youngerLion  = new Lion(300, "Animal_Pictures/Lion.jpg", "Animal_Sounds/hippo2.wav", rand.Next(1000, 10000).ToString());
            Elephant zebra        = new Elephant(1000, "Animal_Pictures/Zebra.jpg", "Animal_Sounds/zebra5.wav", rand.Next(1000, 10000).ToString());
            Tiger    tiger        = new Tiger(670, "Animal_Pictures/Tiger.jpg", "Animal_Sounds/tiger.wav", rand.Next(1000, 10000).ToString());
            Eagle    canari       = new Eagle(0.05d, "Animal_Pictures/Canari.jpg", "Animal_Sounds/canary.wav", rand.Next(1000, 10000).ToString());
            Whale    whale        = new Whale(9000, "Animal_Pictures/Whale.jpg", "Animal_Sounds/whale.wav", rand.Next(1000, 10000).ToString());
            Eagle    mockingbird  = new Eagle(0.1d, "Animal_Pictures/Canari.jpg", "Animal_Sounds/mockingbird.wav", rand.Next(1000, 10000).ToString());
            Elephant elephant     = new Elephant(12000, "Animal_Pictures/Elephant.jpg", "Animal_Sounds/elephant.wav", rand.Next(1000, 10000).ToString());
            Lion     lion         = new Lion(420, "Animal_Pictures/Lion.jpg", "Animal_Sounds/dolphin3.wav", rand.Next(1000, 10000).ToString());
            Tiger    youngerTiger = new Tiger(550, "Animal_Pictures/Tiger.jpg", "Animal_Sounds/tiger.wav", rand.Next(1000, 10000).ToString());
            Whale    youngerWhale = new Whale(10000, "Animal_Pictures/Whale.jpg", "Animal_Sounds/whale.wav", rand.Next(1000, 10000).ToString());

            //add to list
            animals.Add(vulture);
            animals.Add(youngerLion);
            animals.Add(zebra);
            animals.Add(tiger);
            animals.Add(canari);
            animals.Add(whale);
            animals.Add(mockingbird);
            animals.Add(elephant);
            animals.Add(lion);
            animals.Add(youngerTiger);
            animals.Add(youngerWhale);
            //put names in array
            names = new string[11] {
                "vulture", "younger lion", "zebra", "tiger", "canari", "whale", "mockingbird", "elephant", "lion", "younger tiger", "younger whale"
            };
        }
Exemplo n.º 6
0
 public void Init()
 {
     eagle     = new Eagle();
     cat       = new Cat();
     canFly    = new CanFly();
     canNotFly = new CanNotFly();
 }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            var fido = new Dog()
            {
                Id    = 1,
                Name  = "Fido",
                Breed = "Pug"
            };

            fido.GoTo("Park");
            fido.MakeNoise();

            //IAnmial is parent type of Dog.
            //Dog is subtype of IAnimal

            var animals = new IAnimal[2];

            animals[0] = fido;
            animals[1] = new Eagle()
            {
                Id   = 2,
                Name = "Chirpy"
            };

            foreach (var Item in animals)
            {
                Console.WriteLine(Item.Name);
                Item.MakeNoise();
            }
        }
Exemplo n.º 8
0
        public void EagleCanEat()
        {
            Eagle  testEagle   = new Eagle();
            string testMessage = testEagle.Eat();

            Assert.Equal("The eagle is now eating a mouse.", testMessage);
        }
Exemplo n.º 9
0
//-----------------------------Main-----------------------------

        static void Main(string[] args)
        {
            Plane   p   = new Plane("Бройлер 747");
            Plane   fb  = new Plane("Turbo Otter");
            Eagle   e   = new Eagle("Орел");
            Duck    d   = new Duck("Утка");
            Chicken ch  = new Chicken("Polly");
            M_boat  mb  = new M_boat("Zodiac");
            Bunny   bun = new Bunny("Bunny");

            ISwim[] swim = { fb, d, ch, mb, bun };
            IFly[]  fly  = { p, fb, e, d };

            Console.WriteLine("\n-----------------Swimming objects------------------\n");

            foreach (Some_Entity se in swim)
            {
                se.AboutMe();
            }

            Console.WriteLine("\n----------------Flying objects---------------------\n");

            foreach (Some_Entity se in fly)
            {
                se.AboutMe();
            }

            Console.ReadLine();
        }
Exemplo n.º 10
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            Eagle eagle = new Eagle();

            Console.WriteLine("The eagle object");
            Console.WriteLine("Eagles say: ");
            Console.WriteLine(eagle.Caws());
            Console.WriteLine("Eagles can fly.....");
            Console.WriteLine(eagle.CanFly());
            Console.WriteLine();
            Console.WriteLine();
            Lion leon = new Lion();

            Console.WriteLine("Lion object");
            Console.WriteLine("Lions can roar....");
            Console.WriteLine(leon.Roars());
            Console.WriteLine("Lions have this many cubs: ");
            Console.WriteLine(leon.HaveBabies());
            Console.WriteLine("The lions fur color is: ");
            Console.WriteLine(leon.FurColor);
            Console.WriteLine("Press any key to continue....");
            Console.ReadKey();
        }
Exemplo n.º 11
0
    public static void Main()
    {
        FlyingSquirrel rocky = new FlyingSquirrel();
        Eagle          sam   = new Eagle();

        List <IWalking> birds = new List <IWalking>();

        //type squirrel , class squirrel
        birds.Add(sam);
        //type eagle, class eagle
        birds.Add(rocky);

        // the foreach will loop through rocky-type FlyingSquirrel , sam-type Eagle
        foreach (var thing in birds)
        {
            //each thing has a type or class, will refer to the method fly in that specific class
            // fly method consoles a message
            // thing.Fly();
            thing.Walk();
        }
        sam.Fly();
        sam.Walk();
        sam.AirSpeed = 5;
        Console.WriteLine($"sam's airspeed {sam.AirSpeed}");
    }
Exemplo n.º 12
0
        public void TestBirdCanFlyWithOneWingInBadOrWorseCondition()
        {
            var eagleWithOneWingInBadCondition = new Eagle(Gender.Female);
            eagleWithOneWingInBadCondition.Wings[0].Condition = Condition.Bad;

            Assert.IsTrue(eagleWithOneWingInBadCondition.IsAbleToFly);
        }
Exemplo n.º 13
0
        public void TestBirdCantFlyWithWingBadAndOneUnusableCondition()
        {
            var eagleWithTwoWingsInBadCondition = new Eagle(Gender.Male);
            eagleWithTwoWingsInBadCondition.Wings[0].Condition = Condition.Bad;
            eagleWithTwoWingsInBadCondition.Wings[1].Condition = Condition.Unusable;

            Assert.IsFalse(eagleWithTwoWingsInBadCondition.IsAbleToFly);
        }
Exemplo n.º 14
0
        public void EagleInheritsWalk()
        {
            //Walk is in Bird, not Pidgeon
            Eagle  testEagle   = new Eagle();
            string testMessage = testEagle.Walk();

            Assert.Equal("The Eagle walks around its nest in the Countryside.", testMessage);
        }
Exemplo n.º 15
0
 static void Main(string[] args)
 {
     Animal newGuy   = new Animal("unknow", 0);
     Fish   newFish  = new Fish("fish", 1);
     Shark  newShark = new Shark("shark", 2);
     Bird   newBird  = new Bird("bird", 1);
     Eagle  newEagle = new Eagle("eagle", 2);
 }
Exemplo n.º 16
0
        public void EagleOverridesLivesIn()
        {
            //LivesIn is in Bird
            Bird  testBird  = new Pidgeon();
            Eagle testEagle = new Eagle();

            Assert.NotEqual(testEagle.LivesIn, testBird.LivesIn);
        }
Exemplo n.º 17
0
        private void button2_Click(object sender, EventArgs e)
        {
            Eagle      eagle = new Eagle(textBox1.Text);
            Helicopter h     = new Helicopter(textBox2.Text);

            eagle.SayFlyCondition();
            h.SayFlyCondition();
        }
Exemplo n.º 18
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            Dog fido1 = new Dog();

            fido1.AnimalId = 1;
            fido1.Name     = "Fido";
            fido1.Breed    = "Doberman";


            Dog fido2 = new Dog
            {
                AnimalId = 1,
                Name     = "Fido",
                Breed    = "Doberman",
            };


            fido1.GoTo("Park");
            fido1.MakeNoise();


            IAnimal animal = fido1;

            //animal.Breed = "";
            //Bird bird = (Bird)animal;

            Dog dog3 = (Dog)animal;


            int integer = (int)3.4;

            double num = integer;


            var animals = new IAnimal[2];

            animals[0] = fido1;
            animals[1] = new Eagle
            {
                AnimalId = 3,
                Name     = "Bill"
            };



            foreach (var item in animals)
            {
                Console.WriteLine(item.Name);
                item.MakeNoise();
                item.GoTo("Park");
            }


            MakeNoise(dog3);//upcasted to the function below with the static call.
        }
Exemplo n.º 19
0
        static void Main(string[] args)
        {
            Enimal leo = new Leopard();
            //leo.Live();
            //leo.Run();
            //leo.Voise();

            Enimal croc = new Crocodile();
            //croc.Live();
            //croc.Crawling();
            //croc.Voise();

            Enimal orel = new Eagle();
            //orel.Live();
            //orel.Fly();
            //orel.Voise();

            Enimal carp = new Carp();
            //carp.Live();
            //carp.Float();
            //carp.Voise();

            List <Enimal> myzoo = new List <Enimal>();

            myzoo.Add(leo);
            myzoo.Add(croc);
            myzoo.Add(orel);
            myzoo.Add(carp);

            foreach (Enimal item in myzoo)
            {
                item.Live();
                item.Voise();

                Mammal  newMammal  = item as Mammal;
                Fish    newFish    = item as Fish;
                Bird    newBird    = item as Bird;
                Reptile newreptile = item as Reptile;

                if (newMammal is Mammal)
                {
                    newMammal.Run();
                }
                else if (newFish is Fish)
                {
                    newFish.Float();
                }
                else if (newBird is Bird)
                {
                    newBird.Fly();
                }
                else if (newreptile is Reptile)
                {
                    newreptile.Crawling();
                }
            }
        }
Exemplo n.º 20
0
        public void UniqueIdStrings()
        {
            var    a1  = new Eagle("", Gender.Male, 0, 0, 0);
            var    a2  = new Eagle("", Gender.Male, 0, 0, 0);
            string id1 = a1.Id;
            string id2 = a2.Id;

            Assert.IsTrue(0 == String.Compare(id1, id1, StringComparison.Ordinal));
            Assert.IsTrue(0 < String.Compare(id2, id1, StringComparison.Ordinal)); // id2 has later ID number than id1.
        }
Exemplo n.º 21
0
        public void CloningEagle()
        {
            Eagle e2 = new Eagle("e2", Gender.Male, 0, 0, 0);

            Animal e3 = e2.Clone();

            Assert.AreEqual(e2.Name, e3.Name);
            Assert.AreEqual(e2.Id, e3.Id);
            Assert.AreNotSame(e2, e3);
        }
Exemplo n.º 22
0
        public void CanReturnTrueFromIsSinging()
        {
            // Arrange
            Eagle eagle = new Eagle("Harry");
            // Act
            bool returnFromMethod = eagle.Singing();

            // Assert
            Assert.True(returnFromMethod);
        }
Exemplo n.º 23
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            var fido1 = new Dog();

            fido1.AnimalId = 1;
            fido1.Name     = "Fido";
            fido1.Breed    = "Doberman";

            var fido2 = new Dog
            {
                AnimalId = 1,
                Name     = "Fido",
                Breed    = "Doberman"
            };

            fido1.GoTo("park");
            fido1.MakeNoise();

            IAnimal animal = fido1;

            //animal.Breed = "";

            //Bird bird = (Bird)animal;
            Dog dog3 = (Dog)animal;

            int    integer = (int)3.4;
            double num     = integer;

            var animals = new IAnimal[2];

            animals[0] = fido1;
            animals[1] = new Eagle
            {
                AnimalId = 3,
                Name     = "Bill"
            };

            foreach (var item in animals)
            {
                Console.WriteLine(item.Name);
                item.MakeNoise();
                item.GoTo("park");
            }

            Eagle eagle1 = (Eagle)animals[1];

            //eagle.GoTo

            MakeNoise(dog3);

            // use camelcase for local variables and private fields
            // TitleCase aka PascalCase for everything else
        }
Exemplo n.º 24
0
        public void CanReturnEagleFormOfProcreation()
        {
            // Arrange
            Eagle  eagle    = new Eagle("Harry");
            string expected = "Lays one to three eggs three times a year.";
            // Act
            string returnFromMethod = eagle.FormOfProcreation();

            // Assert
            Assert.Equal(expected, returnFromMethod);
        }
Exemplo n.º 25
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            Animal[] animals = new Animal[5];
            ISpeak[] Speaker = new ISpeak[4];

            Manticore ElPapi = new Manticore {
                Name = "ElPapi", Diet = "Blood and Bones", Lift = (1000 * 32.17), Intro = "I am ElPapi"
            };
            Mermaid KanyeBass = new Mermaid {
                Name = "KanyeBass", Diet = "FishSticks", IsIntelligent = false, Intro = "I love FishSticks"
            };
            Eagle Freedom = new Eagle {
                Name = "Freedom", HasFins = false, NumWings = 50, Lift = 1817, Diet = "Worms"
            };
            Rhino Rocksteady = new Rhino {
                Name = "Rocksteady", NumOfLegs = 4, Diet = "Meat and more meat", Intro = "I'm gonna crush those pesky ninja turtles"
            };
            Dragon Oenomaus = new Dragon {
                Name = "Oenomaus", IsIntelligent = true, Intro = "Im a DAWG BOWWWWWWW", Diet = "All meat baby", HasTeeth = true
            };

            Speaker[0] = ElPapi;
            Speaker[1] = KanyeBass;
            Speaker[2] = Rocksteady;
            Speaker[3] = Oenomaus;

            animals[0] = ElPapi;
            animals[1] = KanyeBass;
            animals[2] = Freedom;
            animals[3] = Rocksteady;
            animals[4] = Oenomaus;

            for (int i = 0; i < Speaker.Length; i++)
            {
                var speakers = Speaker[i];

                if (speakers is HasWings)
                {
                    var speakingWings = (HasWings)speakers;
                    speakingWings.ImFlying();
                }
                else if (speakers is NoWings)
                {
                    var grounded = (NoWings)speakers;
                    grounded.GroundBB();
                }
            }
            for (int i = 0; i < animals.Length; i++)
            {
                Console.WriteLine($"My name is {animals[i].Name} and I like to eat {animals[i].Diet}");
            }
        }
Exemplo n.º 26
0
        public void PlayerRespawn_OnlyRespawnsPlayers()
        {
            Wall  wall  = new Wall(0, 0, false);
            Eagle eagle = new Eagle(0, 0);

            wall.Life  = 0;
            eagle.Life = 0;
            wall.PlayerRespawn();
            eagle.PlayerRespawn();
            Assert.That(eagle.Life == 0 && wall.Life == 0);
        }
Exemplo n.º 27
0
        public void CanReturnEagleMoving()
        {
            // Arrange
            Eagle  eagle    = new Eagle("Harry");
            string expected = "Flyyyyy like an eagle";
            // Act
            string returnFromMethod = eagle.Moving();

            // Assert
            Assert.Equal(expected, returnFromMethod);
        }
Exemplo n.º 28
0
        public void CanReturnIsFlying()
        {
            // Arrange
            Eagle  eagle    = new Eagle("Harry");
            string expected = $"{eagle.Name} is flying so high";
            // Act
            string returnFromMethod = eagle.IsFlying();

            // Assert
            Assert.Equal(expected, returnFromMethod);
        }
        protected void SeedData(InheritanceContext context)
        {
            var kiwi = new Kiwi
            {
                Species      = "Apteryx haastii",
                Name         = "Great spotted kiwi",
                IsFlightless = true,
                FoundOn      = Island.South
            };

            var eagle = new Eagle
            {
                Species = "Aquila chrysaetos canadensis",
                Name    = "American golden eagle",
                Group   = EagleGroup.Booted
            };

            eagle.Prey.Add(kiwi);

            var rose = new Rose
            {
                Species   = "Rosa canina",
                Name      = "Dog-rose",
                HasThorns = true
            };

            var daisy = new Daisy
            {
                Species = "Bellis perennis",
                Name    = "Common daisy"
            };

            var nz = new Country {
                Id = 1, Name = "New Zealand"
            };

            nz.Animals.Add(kiwi);

            var usa = new Country {
                Id = 2, Name = "USA"
            };

            usa.Animals.Add(eagle);

            context.Set <Animal>().Add(kiwi);
            context.Set <Bird>().Add(eagle);
            context.Set <Country>().Add(nz);
            context.Set <Country>().Add(usa);
            context.Set <Rose>().Add(rose);
            context.Set <Daisy>().Add(daisy);

            context.SaveChanges();
        }
Exemplo n.º 30
0
 protected TroopMember()
 {
     Scout       = new Scout();
     Tenderfoot  = new Tenderfoot();
     SecondClass = new SecondClass();
     FirstClass  = new FirstClass();
     Star        = new Star();
     Life        = new Life();
     Eagle       = new Eagle();
     EaglePalms  = new List <Palm>();
     MeritBadges = new List <MeritBadge>();
 }
Exemplo n.º 31
0
        public void TestThatEagleInheritsBehaviors()
        {
            Eagle mordor = new Eagle()
            {
                Name = "Mordor"
            };

            string input    = $"{mordor.Name} {mordor.IsAPet()}";
            string expected = $"{mordor.Name} Am I your pet?";

            Assert.Equal(expected, input);
        }
        static void Main(string[] args)
        {
            Animal[] animals =
            {
                new Tiger(),
                new Deer(),
                new Horse(),
                //new Bird(),
                new Snake(),
                new Cow(),
                //new Animal(),
                new Crocodile(),
                new Parrot(),
                // new Reptile(),
                new Camel(),
                //new Mammal(),
                //new Cat(),
                new Eagle(),
                new Dog(),
            };



            foreach (var animal in animals)
            {
                if (animal.IsDomestic)
                {
                    Console.Write("Domestic ");
                }
                Console.WriteLine("Animal is " + animal);

                Console.WriteLine(animal.Move());
                Console.WriteLine(animal.Eat());
                Console.WriteLine(animal.Breed());

                //de-abstraction <--- NOT RECOMMENDED!
                //HuntIfYouAreATiger(animal);

                //re-abstraction
                HuntIfYouAreAHunter(animal);

                RideIfRideable(animal);

                Console.WriteLine(animal.Die());

                Console.WriteLine();
            }

            Console.WriteLine("Special Eagle's Death");
            Eagle eagle = new Eagle();

            Console.WriteLine(eagle.Die());
        }
Exemplo n.º 33
0
 public Widget()
 {
     this.genre = null;
     this.slide = null;
     this.scale = null;
     this.eagle = null;
     this.tools = null;
     this.menus = null;
     this.popup = null;
     this.about = null;
     this.await = null;
 }
Exemplo n.º 34
0
        static void Main(string[] args)
        {
            var Impy = new Goblin(Gender.Male, "Impy");
            var Madeline = new Elf(Gender.Female, "Madeline");
            var Rumbolf = new Dwarf(Gender.Male, "Rumbolf");
            var Walter = new Human(Gender.Male, "Walter");

            var eagle = new Eagle(Gender.Female);
            var eagleWithOneFrozenWing = new Eagle(Gender.Female);
            eagleWithOneFrozenWing.Wings[0].Frozen = true;
            var eagleWithOneWingInBadCondition = new Eagle(Gender.Female);
            eagleWithOneWingInBadCondition.Wings[0].Condition = Condition.Bad;
            var eagleWithTwoWingsInBadCondition = new Eagle(Gender.Male);
            eagleWithTwoWingsInBadCondition.Wings[0].Condition = Condition.Bad;
            eagleWithTwoWingsInBadCondition.Wings[1].Condition = Condition.Unusable;

            var isAbleToFlyTest1 = eagleWithOneFrozenWing.IsAbleToFly;
            var isAbleToFlyTest2 = eagleWithOneWingInBadCondition.IsAbleToFly;
            var isAbleToFlyTest3 = eagleWithTwoWingsInBadCondition.IsAbleToFly;

            var entities = new List<Entity>
            {
                Impy,
                Madeline,
                Rumbolf,
                Walter,
                eagle,
                eagleWithOneFrozenWing,
                eagleWithOneWingInBadCondition,
                eagleWithTwoWingsInBadCondition
            };

            var hp = Walter.Hitpoints;
            var mn = Walter.Mana;

            var s = "";
        }
        private void MergeLibrary(Component obj, Eagle.eagle eagleSrc, Eagle.libraries libsDst, string libName)
        {
            var libSrc = eagleSrc.drawing.Item as Eagle.library;
            if (libSrc == null)
            {
                Logger.WriteWarning("No Schematic Library for Component: <a href=\"MGA:{0}\">{1}</a>", obj.Impl.ID, obj.Impl.Name);
                return;
            }
            if (String.IsNullOrWhiteSpace(libName))
                libName = "library-noname";
            var libDst = libsDst.library.Where(l => l.name.Equals(libName)).FirstOrDefault();
            if (libDst == null)
            {
                libSrc.name = libName;
                libsDst.library.Add(libSrc);
            }
            else
            {
                // keep the description
                // add to packages, add to symbols, add to device-sets/devices
                foreach (Eagle.package pkg in libSrc.packages.package)
                {
                    if (libDst.packages.package.Where(p => p.name.Equals(pkg.name)).Count() == 0)
                        libDst.packages.package.Add(pkg);
                }
                foreach (Eagle.symbol sym in libSrc.symbols.symbol)
                {
                    if (libDst.symbols.symbol.Where(s => s.name.Equals(sym.name)).Count() == 0)
                        libDst.symbols.symbol.Add(sym);
                }
                foreach (Eagle.deviceset dset in libSrc.devicesets.deviceset)
                {
                    if (libDst.devicesets.deviceset.Where(d => d.name.Equals(dset.name)).Count() == 0)
                        libDst.devicesets.deviceset.Add(dset);
                    else
                    {
                        var dstDset = libDst.devicesets.deviceset.Where(d => d.name.Equals(dset.name)).FirstOrDefault();
                        foreach (Eagle.device dev in dset.devices.device)
                        {
                            if (dstDset.devices.device.Where(dd => dd.name.Equals(dev.name)).Count() == 0)
                                dstDset.devices.device.Add(dev);
                        }
                    }
                }

            }

        }
        private void visit(Port obj, Eagle.net net_obj)
        {
            if (!(obj.Parent.Impl is Tonka.TestComponent))
            {
                // create a segment for this object
                var segment_obj = new Eagle.segment();
                CreateWireSegment(obj, segment_obj);  // simple routing
                CreatePinRef(obj, segment_obj); // destination pin
                net_obj.segment.Add(segment_obj);
            }
            PortNetMap[obj] = net_obj;  // add to map

            var allPorts = 
                (from conn in obj.DstConnections select conn.DstPort).Union
                (from conn in obj.SrcConnections select conn.SrcPort);

            foreach (var port in allPorts) // visit sources
            {
                if (!PortNetMap.ContainsKey(port))
                    this.visit(port, net_obj);
            }
        }
Exemplo n.º 37
0
 public void SetUp()
 {
     this.Eagle = new Eagle(Gender.Female);
 }
 private void GenerateLayoutCode(Eagle.eagle eagle, Schematic.TestBench TestBench_obj)
 {
     // write layout file
     string layoutFile = Path.Combine(this.mainParameters.OutputDirectory, "layout-input.json");
     new Layout.LayoutGenerator(eagle.drawing.Item as Eagle.schematic, TestBench_obj, Logger).Generate(layoutFile);
 }
 private void CreatePinRef(Port obj, Eagle.segment segment_obj)
 {
     var gate = obj.Impl.Attributes.EDAGate;
     var pinref_obj = new Eagle.pinref();
     pinref_obj.gate = (String.IsNullOrWhiteSpace(gate) == false) ? gate : "gate-unknown";
     pinref_obj.part = obj.Parent.Name;
     pinref_obj.pin = obj.Name;
     segment_obj.Items.Add(pinref_obj);
 }
        private void CreateWireSegment(Port port, Eagle.segment segment_obj)
        {
            // create two short wire segments: 1. from src pin to, and 2. to dst pin
            // TODO: create vertical segments for vertical pins (or rotated symbols)
            var wire_obj = new Eagle.wire();
            var rot = port.Impl.Attributes.EDASymbolRotation;
            double x1 = port.CanvasX;
            double y1 = port.CanvasY;
            double x2 = x1;
            double y2 = y1;
            if (rot.Equals("R90") || rot.Equals("90"))
                y2 -= netLength; // 90 pointing down
            else if (rot.Equals("R270") || rot.Equals("270"))
                y2 += netLength; // 270 pointing up
            else if (rot.Equals("R180") || rot.Equals("180"))
                x2 += netLength; // 180 going right
            else
                x2 -= netLength; // 0 going left

            wire_obj.x1 = x1.ToString("F2");
            wire_obj.y1 = y1.ToString("F2");
            wire_obj.x2 = x2.ToString("F2");
            wire_obj.y2 = y2.ToString("F2");
            wire_obj.layer = netLayer;
            wire_obj.width = wireWidth;
            segment_obj.Items.Add(wire_obj);

            var label_obj = new Eagle.label();
            label_obj.x = wire_obj.x2;
            label_obj.y = wire_obj.y2;
            label_obj.size = labelSize;
            label_obj.layer = nameLayer;
            segment_obj.Items.Add(label_obj);
        }
Exemplo n.º 41
0
        public ISqlQuery OrderBy(string column, Eagle.Core.Query.SortOrder sortOrder)
        {
            this.SqlBuilder.OrderBy(column, sortOrder);

            return this;
        }