Esempio n. 1
0
        /**
         * Processes a single fragment into fragment(s). Override this method
         * in your implementation to process individual drawables into more
         * fragments.
         *
         * @param input
         *      Single fragment to convert
         * @param env
         *      Contextual compilation information
         * @return
         *      The converted input data. The default implementation of this
         *      method returns the input data.
         */
        public virtual FragmentList process(Fragment drawable, FilterEnv env)
        {
            FragmentList output = new FragmentList();

            output.Add(drawable);
            return(output);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates the DOM and Refreshes the spreadsheet control in the background.
        /// </summary>
        /// <remarks>
        /// This thread is responsible for recreating the Document Object Model for the blotter and translating
        /// that DOM into a format compatible with the spreadsheet viewer.  It will call the foreground when the
        /// DOM is complete to either update the entire document, if the structure has changed, or only update
        /// the changed cells, when only the data has changed.
        /// </remarks>
        private void DrawFragmentCommand(object parameter)
        {
            // Extract the list of fragments from the thread parameters.
            FragmentList fragmentList = (FragmentList)parameter;

#if DEBUGXML
            // This will create an XML Document containing only the records and fields that have changed since the viewer was
            // last updated.
            XmlDocument stagedOrderFragment = new MatchHistoryDocument(fragmentList);

            // Make sure that writing the debug file doesn't interrupt the session.
            try
            {
                // During debugging, it's very useful to have a copy of the DOM on the disk.
                stagedOrderFragment.Save("stagedOrderFragment.xml");
            }
            catch (Exception exception)
            {
                // Write the error and stack trace out to the event log.
                EventLog.Error("{0}, {1}", exception.Message, exception.StackTrace);
            }

            // This will write the changes to the viewer by passing it through the stylesheet.
            this.XmlDocument = stagedOrderFragment;
#else
            // This will write the changes to the viewer by passing it through the stylesheet.
            //this.XmlDocument = new MatchHistoryDocument(fragmentList);
            this.XmlDocument = new QuoteDocument(fragmentList);
#endif
        }
Esempio n. 3
0
        public static void Main(string[] args)
        {
            var rnd   = new Random();
            var flist = new FragmentList <int>();
            var list  = new List <int>();
            var fsw   = new Stopwatch();
            var sw    = new Stopwatch();

            Console.Clear();
            Console.WriteLine("Press Escape to leave");
            var left = Console.CursorLeft;
            var top  = Console.CursorTop;

            while (true)
            {
                if (Console.KeyAvailable)
                {
                    var key = Console.ReadKey();
                    if (key.Key == ConsoleKey.Escape)
                    {
                        break;
                    }
                }
                test(rnd, flist, fsw, list, sw);
                display(flist, fsw, list, sw, left, top);
            }
        }
Esempio n. 4
0
    public FragmentList <T> GetFragmentRange(int index, int count)
    {
        var info = getInfo(index, count);

        if (info == null)
        {
            throw new ArgumentOutOfRangeException();
        }
        index -= info.PrevSum;
        var result = new FragmentList <T>();

        for (var i = info.StartArrayIndex; i <= info.EndArrayIndex; i++)
        {
            var arr = _bucket[i];
            var cnt = Math.Min(count, arr.Count - index);
            result._bucket.Add(arr.GetRange(index, cnt));
            count -= cnt;
            if (count == 0)
            {
                break;
            }
            index = 0;
        }
        return(result);
    }
Esempio n. 5
0
        private static void testAddRange(Random rnd, FragmentList <int> lst, Stopwatch sw)
        {
            var ien = randomRange(rnd);

            sw.Start();
            lst.AddRange(ien);
            sw.Stop();
        }
Esempio n. 6
0
        //フラグメントを作成
        public GameObject CreateFragment()
        {
            GameObject f = HomographyFragment.CreateFragment("fragment", mHomographyShader, mTextureBuffer);

            f.transform.SetParent(mHomographyController.transform);
            FragmentList.Add(f.GetComponent <HomographyFragment> ());
            return(f);
        }
Esempio n. 7
0
        static int Gather(FragmentList dest, FragmentList src, int cut, int offset)
        {
            unchecked
            {
                int postend, c, l;
                var s = src.Head;

                while(s != src.Tail)
                {
                    if(s.Value.Start + offset >= cut)
                        break; /* We've gone far enough */

                    postend = offset + s.Value.Start + s.Value.Length;
                    if(postend <= cut)
                    {
                        /* Save this hunk */
                        offset += s.Value.Start + s.Value.Length - s.Value.End;
                        dest.Add(s.Value);
                        s = s.Next;
                    } // if
                    else
                    {
                        /* Break up this hunk */
                        c = cut - offset;
                        if(s.Value.End < c)
                        {
                            c = s.Value.End;
                        }
                        l = cut - offset - s.Value.Start;
                        if(s.Value.Length < l)
                            l = s.Value.Length;

                        offset += s.Value.Start + l - c;

                        Fragment d = new Fragment();

                        d.Start = s.Value.Start;
                        d.End = c;
                        d.Length = l;
                        d.Data = s.Value.Data;
                        d.Offset = s.Value.Offset;

                        dest.Add(d);

                        s.Value = new Fragment(c, s.Value.End, s.Value.Length - l, s.Value.Offset + l, s.Value.Data);
                        /*s.Value.Start = c;
                        s.Value.Length = s.Value.Length - l;
                        s.Value.Offset = s.Value.Offset + l;*/

                        break;
                    } // else
                }

                src.Head = s;

                return offset;
            }
        }
Esempio n. 8
0
        private static void testInsertRange(Random rnd, FragmentList <int> lst, Stopwatch sw)
        {
            var ien = randomRange(rnd);
            var n   = rnd.Next(0, lst.Count);

            sw.Start();
            lst.InsertRange(n, ien);
            sw.Stop();
        }
Esempio n. 9
0
        public override FeatureList process(FeatureList input, FilterEnv env)
        {
            FeatureList output = new FeatureList();

            //Boolean encontrado = false;
            SharpMap.Geometries.BoundingBox boundingBox = new SharpMap.Geometries.BoundingBox(longitudeMin, latitudeMin, longitudeMax, latitudeMax);

            foreach (Feature feature in input)
            {
                //if type of features is Point
                if (feature.row.Geometry is SharpMap.Geometries.Point)
                {
                    SharpMap.Geometries.Point p = (SharpMap.Geometries.Point)feature.row.Geometry;
                    if (boundingBox.Contains(p.GetBoundingBox()))
                    {
                        output.Add(feature);
                    }
                }
                //if type of features is Polygon
                else if (feature.row.Geometry is SharpMap.Geometries.Polygon)
                {
                    SharpMap.Geometries.Polygon polygon = (SharpMap.Geometries.Polygon)feature.row.Geometry;
                    if (boundingBox.Contains(polygon.GetBoundingBox()))
                    {
                        output.Add(feature);
                    }
                }
                //if type of features is MultiPolygon
                else if (feature.row.Geometry is SharpMap.Geometries.MultiPolygon)
                {
                    SharpMap.Geometries.MultiPolygon mp = (SharpMap.Geometries.MultiPolygon)feature.row.Geometry;
                    SharpMap.Geometries.BoundingBox  bb = mp.GetBoundingBox();
                    if (boundingBox.Contains(bb))
                    {
                        output.Add(feature);
                    }
                }
            }

            if (successor != null)
            {
                if (successor is FeatureFilter)
                {
                    FeatureFilter filter = (FeatureFilter)successor;
                    FeatureList   l      = filter.process(output, env);
                }
                else if (successor is FragmentFilter)
                {
                    FragmentFilter filter = (FragmentFilter)successor;
                    FragmentList   l      = filter.process(output, env);
                }
            }

            return(output);
        }
Esempio n. 10
0
        /**
         * Processes a collection of features into fragments. Override this
         * method in your implementation to convert batches of features into
         * fragments.
         *
         * @param input
         *      Batch of features to convert into drawables
         * @param env
         *      Contextual compilation information
         * @return
         *      The converted input data. The default implementation of this
         *      method returns an empty set.
         */
        public virtual FragmentList process(FeatureList input, FilterEnv env)
        {
            FragmentList output = new FragmentList();

            foreach (Feature i in input)
            {
                FragmentList interim = process(i, env);
                output.InsertRange(output.Count, interim);
            }
            return(output);
        }
Esempio n. 11
0
        /**
         * Processes a collection of fragments into a collection of nodes.
         *
         * @param input
         *      Batch of fragments to process
         * @param env
         *      Contextual compilation environment
         * @return
         *      Resulting node list
         */
        public virtual AttributedNodeList process(FragmentList input, FilterEnv env)
        {
            AttributedNodeList output = new AttributedNodeList();

            foreach (Fragment i in input)
            {
                AttributedNodeList interim = process(i, env);
                output.InsertRange(output.Count, interim);
            }
            return(output);
        }
Esempio n. 12
0
 private static void display(FragmentList <int> flist, Stopwatch fsw, List <int> list, Stopwatch sw, int left, int top)
 {
     Console.CursorLeft = left;
     Console.CursorTop  = top;
     Console.WriteLine($"Normal:   {list.Count} {list.Capacity} {sw.Elapsed}".PadRight(20));
     Console.WriteLine($"Fragment: {flist.Count} {flist.Capacity} {fsw.Elapsed}".PadRight(20));
     Console.WriteLine($"{flist}".PadRight(1000));
     if (!flist.SequenceEqual(list))
     {
         throw new Exception("Lists are different");
     }
 }
Esempio n. 13
0
        public Text AddText(string name, string textValue = "")
        {
            var item = new Text(GenDataBase)
            {
                GenObject = ((GenObject)GenObject).CreateGenObject("Text"),
                Name      = name,
                TextValue = textValue
            };

            FragmentList.Add(item);
            return(item);
        }
Esempio n. 14
0
        void Update()
        {
            //操作を描画
            {
                Mesh m = ManipulationDrawer.Draw(mDrawManipulationCanvas.transform);
                if (m != null)
                {
                    List <Material> mats = new List <Material> ();
                    for (int i = 0; i < m.subMeshCount; i++)
                    {
                        mats.Add(mDMMaterial);
                    }
                    mDrawManipulationCanvas.GetComponent <MeshRenderer> ().materials = mats.ToArray();
                }
                mDrawManipulationCanvas.mesh = m;
            }

            //フラグメントを更新
            List <HomographyFragment> shouldDeleteFragment = new List <HomographyFragment> ();

            foreach (HomographyFragment fragment in FragmentList)
            {
                if (fragment.FragmentVertices.Count == 0 && fragment.FragmentAnchores.Count == 0)
                {
                    shouldDeleteFragment.Add(fragment);
                }
                fragment.RefreshFragment();
            }
            foreach (HomographyFragment fragment in shouldDeleteFragment)
            {
                FragmentList.Remove(fragment);
                Destroy(fragment.gameObject);
            }

            ManipulationKind editMode = this.EditTarget;

            if (editMode == ManipulationKind.UV)
            {
                RefreshUVEditor();
            }
            if (editMode == ManipulationKind.Vertex)
            {
                RefreshVertexEditor();
            }

            mLineMesh.transform.SetAsFirstSibling();
            mDrawManipulationCanvas.transform.SetAsFirstSibling();
            mUVmesh.transform.SetAsLastSibling();

            //
            mScaleDif_tmp *= 0.75f;
        }
Esempio n. 15
0
        // NodeFilter overrides
        protected virtual AttributedNodeList process(FragmentList input, FilterEnv env)
        {
            AttributedNodeList nodes;

            osg.Geode geode = null;
            for (FragmentList.const_iterator i = input.begin(); i != input.end(); i++)
            {
                Fragment frag = i;

                AttributeList frag_attrs = frag.getAttributes();

                if (!geode)
                {
                    geode = new osg.Geode();
                    nodes.Add(new AttributedNode(geode, frag_attrs));
                }

                for (DrawableList.const_iterator d = frag.getDrawables().begin(); d != frag.getDrawables().end(); d++)
                {
                    geode.addDrawable(d.get());
                }

                bool retire_geode = false;

                // if a fragment name is set, apply it
                if (frag.hasName())
                {
                    geode.addDescription(frag.getName());
                    retire_geode = true;
                }

                if (getEmbedAttributes())
                {
                    embedAttributes(geode, frag_attrs);
                    retire_geode = true;
                }

                // If required, reset the geode point so that the next fragment gets placed in a new geode.
                if (retire_geode)
                {
                    geode = null;
                }
            }

            // with multiple geodes or fragment names, disable geode combining to preserve the node decription.
            if (nodes.Count > 1)
            {
                env.getOptimizerHints().exclude(osgUtil.Optimizer.MERGE_GEODES);
            }

            return(process(nodes, env));
        }
Esempio n. 16
0
        public ContainerFragment AddContainerFragment(string name, string primary = "", string secondary = "")
        {
            var item = new ContainerFragment(GenDataBase)
            {
                GenObject = ((GenObject)GenObject).CreateGenObject("ContainerFragment"),
                Name      = name,
                Primary   = primary,
                Secondary = secondary
            };

            FragmentList.Add(item);
            return(item);
        }
Esempio n. 17
0
        private static void testRemoveRange(Random rnd, FragmentList <int> lst, Stopwatch sw)
        {
            if (lst.Count == 0)
            {
                return;
            }
            var start = rnd.Next(0, lst.Count);
            var count = rnd.Next(0, lst.Count - start);

            sw.Start();
            lst.RemoveRange(start, count);
            sw.Stop();
        }
Esempio n. 18
0
        public Placeholder AddPlaceholder(string name, string @class = "", string property = "")
        {
            var item = new Placeholder(GenDataBase)
            {
                GenObject = ((GenObject)GenObject).CreateGenObject("Placeholder"),
                Name      = name,
                Class     = @class,
                Property  = property
            };

            FragmentList.Add(item);
            return(item);
        }
Esempio n. 19
0
        private static void testExists(Random rnd, FragmentList <int> lst, Stopwatch sw)
        {
            if (lst.Count == 0)
            {
                return;
            }
            var index = rnd.Next(0, lst.Count);
            var val   = rnd.Next();

            sw.Start();
            var result = lst.Exists(v => v < val);

            sw.Stop();
        }
Esempio n. 20
0
        public Annotation AddAnnotation()
        {
            var name       = CreateContainerFragmentBody("Annotation");
            var annotation = new Annotation(GenDataBase)
            {
                GenObject = ((GenObject)GenObject).CreateGenObject("Annotation"),
                Name      = name,
                Primary   = name,
                Secondary = "Empty1"
            };

            FragmentList.Add(annotation);
            SetContainerLinks(annotation);
            return(annotation);
        }
Esempio n. 21
0
        public Profile AddProfile()
        {
            var name    = CreateContainerFragmentBody("Profile");
            var profile = new Profile(GenDataBase)
            {
                GenObject = ((GenObject)GenObject).CreateGenObject("Profile"),
                Name      = name,
                Primary   = name,
                Secondary = "Empty1"
            };

            FragmentList.Add(profile);
            SetContainerLinks(profile);
            return(profile);
        }
Esempio n. 22
0
        public TextBlock AddTextBlock()
        {
            var name      = CreateContainerFragmentBody("TextBlock");
            var textBlock = new TextBlock(GenDataBase)
            {
                GenObject = ((GenObject)GenObject).CreateGenObject("TextBlock"),
                Name      = name,
                Primary   = name,
                Secondary = "Empty1"
            };

            FragmentList.Add(textBlock);
            SetContainerLinks(textBlock);
            return(textBlock);
        }
Esempio n. 23
0
        private static void testBinarySearch(Random rnd, FragmentList <int> lst, Stopwatch sw)
        {
            if (lst.Count == 0)
            {
                return;
            }
            var index = rnd.Next(0, lst.Count);
            var val   = lst[index];
            var val2  = rnd.Next();

            sw.Start();
            var idx = lst.BinarySearch(val);

            if (idx >= 0 && lst[idx] != val)
            {
                throw new Exception("Binary search");
            }
            if (idx < 0)
            {
                idx = ~idx;
                if (idx > 0 && lst[idx - 1] >= val)
                {
                    throw new Exception("Binary search");
                }
                if (idx < lst.Count && lst[idx] <= val)
                {
                    throw new Exception("Binary search");
                }
            }
            idx = lst.BinarySearch(val2);
            if (idx >= 0 && lst[idx] != val2)
            {
                throw new Exception("Binary search");
            }
            if (idx < 0)
            {
                idx = ~idx;
                if (idx > 0 && lst[idx - 1] >= val2)
                {
                    throw new Exception("Binary search");
                }
                if (idx < lst.Count && lst[idx] <= val2)
                {
                    throw new Exception("Binary search");
                }
            }
            sw.Stop();
        }
Esempio n. 24
0
        public Function AddFunction(string functionName = "")
        {
            var name     = "Function" + FragmentList.Count;
            var function = new Function(GenDataBase)
            {
                GenObject    = ((GenObject)GenObject).CreateGenObject("Function"),
                Name         = name,
                Primary      = "Empty1",
                Secondary    = "Empty1",
                FunctionName = functionName
            };

            FragmentList.Add(function);
            SetContainerLinks(function);
            return(function);
        }
Esempio n. 25
0
        public static FragmentList newInstance(int queryType)
        {
            FragmentList f    = new FragmentList();
            Bundle       args = new Bundle();

            args.PutInt("someInt", queryType);

            if (args != null)
            {
                f.Arguments = args;
            }
            else
            {
            }
            return(f);
        }
Esempio n. 26
0
        public Segment AddSegment(string @class = "", string cardinality = "")
        {
            var name    = CreateContainerFragmentBody("Segment");
            var segment = new Segment(GenDataBase)
            {
                GenObject   = ((GenObject)GenObject).CreateGenObject("Segment"),
                Name        = name,
                Primary     = name,
                Secondary   = "Empty1",
                Class       = @class,
                Cardinality = cardinality
            };

            FragmentList.Add(segment);
            SetContainerLinks(segment);
            return(segment);
        }
Esempio n. 27
0
        public override FilterStateResult traverse(FilterEnv in_env)
        {
            FilterStateResult result = new FilterStateResult();

            current_env = in_env.advance();

            FilterState next = getNextState();

            if (next != null)
            {
                FragmentList output =
                    in_features.Count > 0 ? filter.process(in_features, current_env) :
                    in_fragments.Count() > 0 ? filter.process(in_fragments, current_env) :
                    new FragmentList();

                if (output.Count > 0)
                {
                    if (next is NodeFilterState)
                    {
                        NodeFilterState state = (NodeFilterState)next;
                        state.push(output);
                    }
                    else if (next is FragmentFilterState)
                    {
                        FragmentFilterState state = (FragmentFilterState)next;
                        state.push(output);
                    }
                    else if (next is CollectionFilterState)
                    {
                        CollectionFilterState state = (CollectionFilterState)next;
                        state.push(output);
                    }

                    result = next.traverse(current_env);
                }
                else
                {
                    result.set(FilterStateResult.Status.STATUS_NODATA, filter);
                }
            }

            in_features.Clear();
            in_fragments.Clear();

            return(result);
        }
Esempio n. 28
0
        public void render3d(Project project, SceneManager sceneMgr)
        {
            SharpMap.Map myMap = new SharpMap.Map();

            foreach (BuildLayer layer in project.getLayers())
            {
                Source source = layer.getSource();

                BoundingBox    envelope = new BoundingBox(-1000.0, -1000.0, 1000.0, 1000.0);//TODO
                FeatureDataSet ds       = new FeatureDataSet();
                source.DataSource.Open();
                source.DataSource.ExecuteIntersectionQuery(envelope, ds);
                source.DataSource.Close();

                FeatureDataTable features = (FeatureDataTable)ds.Tables[0];

                //El codigo del PFC

                //**********************************************************************************************************

                //Show map

                //Filters
                FilterGraph graph = project.getFilterGraph(source.getName());
                if (graph != null)
                {
                    graph.Successors();

                    FilterEnv   env  = new FilterEnv(sceneMgr, source.getName());
                    FeatureList list = Feature.DataTableToList(features);

                    if (graph.getFilter(1) is FeatureFilter)
                    {
                        FeatureFilter filter = (FeatureFilter)graph.getFilter(1);
                        FeatureList   l      = filter.process(list, env);
                    }
                    else if (graph.getFilter(1) is FragmentFilter)
                    {
                        FragmentFilter filter = (FragmentFilter)graph.getFilter(1);
                        FragmentList   l      = filter.process(list, env);
                    }
                }

                //**********************************************************************************************************
            }
        }
Esempio n. 29
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            ThemeID = Resource.Style.ThemeLight;
            this.SetTheme(ThemeID);
            SetContentView(Resource.Layout.FrameHorizontalDouble);

            try
            {
                UW = new UnitOfWork();
                DatabaseInitializer.PopulateDatabase(UW);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            var frameTop = FragmentManager.FindFragmentById(Resource.Id.Frame01) as FragmentMenuBarHorizontal<List>;
            List list = UW.ListRepo.GetAll().FirstOrDefault<List>();
            if(frameTop == null) frameTop = new FragmentMenuBarHorizontal<List>(list, new BehaviorButtonMenu(), ThemeID);

            var frameBottom = FragmentManager.FindFragmentById(Resource.Id.Frame02) as FragmentList<ItemListItem, CheckedTextView>;

            IEnumerable<ListItem> listItems = from ListItem li in UW.ListItemRepo.GetAll()
                                             where li.ListID == list.ID
                                             select li;

            IEnumerable<Item> items = from Item i in UW.ItemRepo.GetAll()
                                      join ListItem li in listItems on i.ID equals li.ItemID
                                      select i;

            List<ItemListItem> itemListItems = new List<ItemListItem>();

            for(var i = 0; i < listItems.Count(); i++)
            {
                itemListItems.Add(new ItemListItem() { ListItem = listItems.ElementAtOrDefault(i), Item = items.ElementAtOrDefault(i) });
            }

            if(frameBottom == null) frameBottom =
                new FragmentList<ItemListItem, CheckedTextView>(new AdapterItemListItem(this, itemListItems), new BehaviorItemListItem(), ThemeID);

            FragmentControl.CreateFragment(this.FragmentManager, Resource.Id.Frame01, frameTop);

            FragmentControl.CreateFragment(this.FragmentManager, Resource.Id.Frame02, frameBottom);
        }
Esempio n. 30
0
        public Lookup AddLookup(string noMatch = "", string class1    = "", string property1 = "",
                                string class2  = "", string property2 = "")
        {
            var name   = CreateContainerFragmentBody("Lookup");
            var lookup = new Lookup(GenDataBase)
            {
                GenObject = ((GenObject)GenObject).CreateGenObject("Lookup"),
                Name      = name,
                Primary   = name,
                Secondary = "Empty1",
                NoMatch   = noMatch,
                Class1    = class1,
                Property1 = property1,
                Class2    = class2,
                Property2 = property2
            };

            FragmentList.Add(lookup);
            SetContainerLinks(lookup);
            return(lookup);
        }
Esempio n. 31
0
        public Condition AddCondition(string class1 = "", string property1 = "", string comparison = "",
                                      string class2 = "", string property2 = "", string lit        = "", string useLit = "")
        {
            var name      = CreateContainerFragmentBody("Condition");
            var condition = new Condition(GenDataBase)
            {
                GenObject  = ((GenObject)GenObject).CreateGenObject("Condition"),
                Name       = name,
                Primary    = name,
                Secondary  = "Empty1",
                Class1     = class1,
                Property1  = property1,
                Comparison = comparison,
                Class2     = class2,
                Property2  = property2,
                Lit        = lit,
                UseLit     = useLit
            };

            FragmentList.Add(condition);
            SetContainerLinks(condition);
            return(condition);
        }
Esempio n. 32
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            ThemeID = Resource.Style.ThemeLight;
            this.SetTheme(ThemeID);
            SetContentView(Resource.Layout.FrameHorizontalTriple);

            UW = new UnitOfWork();

            var frameTop = FragmentManager.FindFragmentById(Resource.Id.Frame01) as FragmentMenuBarHorizontal<List>;
            List list = UW.ListRepo.GetAll().FirstOrDefault<List>();
            if (frameTop == null) frameTop = new FragmentMenuBarHorizontal<List>(list, new BehaviorButtonMenu(), ThemeID);

            var frameMiddle = FragmentManager.FindFragmentById(Resource.Id.Frame02) as FragmentList<Item, View>;
            IEnumerable<Item> items = UW.ItemRepo.GetAll();
            if (frameMiddle == null) frameMiddle = new FragmentList<Item, View>(new AdapterItem(this, items), new BehaviorItem(), ThemeID);

            var frameBottom = FragmentManager.FindFragmentById(Resource.Id.Frame02) as FragmentItemEdit;
            if (frameBottom == null) frameBottom = new FragmentItemEdit(ThemeID);

            FragmentControl.CreateFragment(FragmentManager, Resource.Id.Frame01, frameTop);
            FragmentControl.CreateFragment(FragmentManager, Resource.Id.Frame02, frameMiddle);
            FragmentControl.CreateFragment(FragmentManager, Resource.Id.Frame03, frameBottom);
        }
Esempio n. 33
0
 public virtual void preMeter(FragmentList drawables, FilterEnv env)
 {
 }
Esempio n. 34
0
        private void SetUpViewPager(ViewPager viewPager)
        {
            myTabAdpater = new TabAdapter(SupportFragmentManager);

            // NuevasAImprimir = 1,
            // AsignarParaNotificar = 2,
            // Notificandose = 3,
            // NotificacionCompletada = 4,
            // ResultadoEnCorreccion = 5,
            // PendienteDeDistribucion = 6,
            // EntregadaAlDespacho = 7

            if (supervisor)
            {
                //Pagina 0
                FragmentList fragmentInstance1 = new FragmentList();
                Bundle       bun1 = new Bundle();
                bun1.PutInt("someInt", 1);
                fragmentInstance1.Arguments = bun1;
                myTabAdpater.AddFragment(fragmentInstance1, "Nuevas a imprimir");

                //Pagina1
                FragmentList fragmentInstance2 = new FragmentList();//AsignarParaNotificar
                Bundle       bun2 = new Bundle();
                bun2.PutInt("someInt", 2);
                fragmentInstance2.Arguments = bun2;
                myTabAdpater.AddFragment(fragmentInstance2, "A notificar"); //se registra el resultado

                //Pagina 2
                FragmentList fragmentInstance3 = new FragmentList();
                Bundle       bun3 = new Bundle();
                bun3.PutInt("someInt", 3);
                fragmentInstance3.Arguments = bun3;
                myTabAdpater.AddFragment(fragmentInstance3, "Notificándose");// supervisor revisa el buzon filtrado por los notificadores.
                viewPager.Adapter = myTabAdpater;
                viewPager.AddOnPageChangeListener(new MyPageChangeListener(this));

                //Pagina 3
                FragmentList fragmentInstance4 = new FragmentList();
                Bundle       bun4 = new Bundle();
                bun4.PutInt("someInt", 4);
                fragmentInstance4.Arguments = bun4;
                myTabAdpater.AddFragment(fragmentInstance4, "A entregar");// supervisor realiza la aprobacion o rechazo de notificaciones, se entiende como Notificaciones completadas
                viewPager.Adapter = myTabAdpater;
                viewPager.AddOnPageChangeListener(new MyPageChangeListener(this));

                //Pagina 4
                FragmentList fragmentInstance5 = new FragmentList();
                Bundle       bun5 = new Bundle();
                bun5.PutInt("someInt", 6);
                fragmentInstance5.Arguments = bun5;
                myTabAdpater.AddFragment(fragmentInstance5, "Entregándose");// supervisor solicita correcion en una notificacion con observaciones incorrectas
                viewPager.Adapter = myTabAdpater;
                viewPager.AddOnPageChangeListener(new MyPageChangeListener(this));

                ////Pagina 4
                //FragmentList fragmentInstance4 = new FragmentList();
                //Bundle bun4 = new Bundle();
                //bun4.PutInt("someInt", 6);
                //fragmentInstance4.Arguments = bun4;
                //myTabAdpater.AddFragment(fragmentInstance4, "Pendiente de distribución");// supervisor solicita correcion sobew notificacion
                //viewPager.Adapter = myTabAdpater;
                //viewPager.AddOnPageChangeListener(new MyPageChangeListener(this));
            }
            else
            {
                //Pagina 0
                FragmentList fragmentInstance1 = new FragmentList();
                Bundle       bun1 = new Bundle();
                bun1.PutInt("someInt", 2);
                fragmentInstance1.Arguments = bun1;
                myTabAdpater.AddFragment(fragmentInstance1, "A notificar"); //se registra el resultado

                //Pagina 1
                FragmentList fragmentInstance2 = new FragmentList();
                Bundle       bun2 = new Bundle();
                bun2.PutInt("someInt", 3);
                fragmentInstance2.Arguments = bun2;
                myTabAdpater.AddFragment(fragmentInstance2, "Notificándose");// supervisor solicita correcion sobew notificacion
                viewPager.Adapter = myTabAdpater;
                viewPager.AddOnPageChangeListener(new MyPageChangeListener(this));

                //Pagina 2
                FragmentList fragmentInstance3 = new FragmentList();
                Bundle       bun3 = new Bundle();
                bun3.PutInt("someInt", 5);
                fragmentInstance3.Arguments = bun3;
                myTabAdpater.AddFragment(fragmentInstance3, "A corregir");// supervisor solicita correcion sobew notificacion
                viewPager.Adapter = myTabAdpater;
                viewPager.AddOnPageChangeListener(new MyPageChangeListener(this));
            }
        }
Esempio n. 35
0
        // NodeFilter overrides
        protected virtual AttributedNodeList process(FragmentList input, FilterEnv env)
        {
            AttributedNodeList nodes;

            osg.Geode geode = null;
            for (FragmentList.const_iterator i = input.begin(); i != input.end(); i++)
            {
                Fragment frag = i;

                AttributeList frag_attrs = frag.getAttributes();

                if (!geode)
                {
                    geode = new osg.Geode();
                    nodes.Add(new AttributedNode(geode, frag_attrs));
                }

                for (DrawableList.const_iterator d = frag.getDrawables().begin(); d != frag.getDrawables().end(); d++)
                {
                    geode.addDrawable(d.get());
                }

                bool retire_geode = false;

                // if a fragment name is set, apply it
                if (frag.hasName())
                {
                    geode.addDescription(frag.getName());
                    retire_geode = true;
                }

                if (getEmbedAttributes())
                {
                    embedAttributes(geode, frag_attrs);
                    retire_geode = true;
                }

                // If required, reset the geode point so that the next fragment gets placed in a new geode.
                if (retire_geode)
                {
                    geode = null;
                }
            }

            // with multiple geodes or fragment names, disable geode combining to preserve the node decription.
            if (nodes.Count > 1)
            {
                env.getOptimizerHints().exclude(osgUtil.Optimizer.MERGE_GEODES);
            }

            return process(nodes, env);
        }
 public void push(FragmentList input)
 {
     in_fragments.InsertRange(in_fragments.Count, input);
 }
Esempio n. 37
0
        private static FragmentList Combine(FragmentList a, FragmentList b)
        {
            unchecked
            {
                int offset = 0;
                int post;
                FragmentList c = new FragmentList();


                for(var bh = b.Head; bh != b.Tail; bh = bh.Next)
                {
                    offset = Gather(c, a, bh.Value.Start, offset);
                    post = Discard(a, bh.Value.End, offset);

                    var ct = new Fragment {
                        Start = bh.Value.Start - offset,
                        End = bh.Value.End - post,
                        Length = bh.Value.Length,
                        Data = bh.Value.Data,
                        Offset = bh.Value.Offset
                    };

                    c.Add(ct);

                    offset = post;
                }

                var t = a.Head;
                for(; t != a.Tail; t = t.Next)
                    c.Add(t.Value);

                return c;
            }
        }
Esempio n. 38
0
        private static FragmentList Decode(IBinaryReader patchReader)
        {
            var l = new FragmentList();
            
            while(patchReader.BaseStream.Position != patchReader.BaseStream.Length)
            {
                var start = patchReader.ReadUInt32();
                var end = patchReader.ReadUInt32();
                var len = patchReader.ReadUInt32();
                var data = patchReader.ReadBytes((int)len);
                
                var f = new Fragment {
                    Start = (int)start,
                    End = (int)end,
                    Length = (int)len,
                    Data = data
                };

                //Console.WriteLine("chunk:" + start + " " + end + " " + len);

                l.Add(f);
            }

            return l;
        }
Esempio n. 39
0
        private static int GetPatchedSize(int len, FragmentList l)
        {
            unchecked
            {
                int outlen = 0;
                int last = 0;

                var f = l.Head;

                while(f != l.Tail)
                {
                    if(f.Value.Start < last || f.Value.End > len)
                        throw new ApplicationException("invalid patch");

                    outlen += f.Value.Start - last;
                    last = f.Value.End;
                    outlen += f.Value.Length;

                    f = f.Next;
                }

                outlen += len - last;
                return outlen;
            }
        }
Esempio n. 40
0
        private static int Apply(byte[] buf, byte[] orig, int len, FragmentList l)
        {
            unchecked
            {
                var last = 0;
                var p = 0;

                for(var f = l.Head; f != l.Tail; f = f.Next)
                {
                    if(f.Value.Start < last || f.Value.End > len)
                        throw new ArgumentException("invalid patch");

                    Buffer.BlockCopy(orig, last, buf, p, f.Value.Start - last);
                    p += f.Value.Start - last;
                    Buffer.BlockCopy(/* src */ f.Value.Data, f.Value.Offset, /* dst */ buf, p, f.Value.Length);
                    last = f.Value.End;
                    p += f.Value.Length;
                }

                Buffer.BlockCopy(orig, last, buf, p, len - last);
                return 1;
            }
        }
Esempio n. 41
0
        // FragmentFilter overrides
        public override FragmentList process(FeatureList input, FilterEnv env)
        {
            FragmentList output = new FragmentList();

            //cuidado con las entidades dentro del for

            int i = 0;
            Vector3 scale;
            Vector3 distanceScale;
            Vector3 mScale = new Vector3 (1,1,1);
            float lWidth = 1;

            if (Scale != null)
            {
                scale = Registry.instance().GetEngine("Python").run(Scale).asVec3();
            }
            else
            {
                scale = new Vector3(1, 1, 1);
            }

            if (CoordScale != null)
            {
                distanceScale = Registry.instance().GetEngine("Python").run(CoordScale).asVec3();
            }
            else
            {
                distanceScale = new Vector3(1, 1, 1);
            }
            if (LineWidth != null)
            {
                lWidth = Registry.instance().GetEngine("Python").run(LineWidth).asFloat();
            }
            if (MaterialScale != null)
            {
                mScale = Registry.instance().GetEngine("Python").run(MaterialScale).asVec3();
            }

            SceneNode nodeIni = point3d(env.getName(), i, 0, 0, 0, null, env.getSceneMgr());
            #if ESCALA_NODO_INICIAL
            if (Scale != null)
            {
                nodeIni.SetScale(Registry.instance().GetEngine("Python").run(Scale).asVec3());
            }
            if (coordScale != null)
            {
                Vector3 vec3 = Registry.instance().GetEngine("Python").run(Scale).asVec3();
                nodeIni.SetPosition(nodeIni.Position.x * vec3.x, nodeIni.Position.y * vec3.y, nodeIni.Position.z * vec3.z);
            #if TRACE_BUILDGEOMFILTER
                        System.Console.WriteLine("(" + n.Position.x + "," + n.Position.y + ")");
            #endif
            }
            #endif
            Fragment fIni = new Fragment(nodeIni);
            output.Add(fIni);

            foreach (Feature feature in input)
            {
                //if type of features is Point
                if (feature.row.Geometry is SharpMap.Geometries.Point)
                {
                    SharpMap.Geometries.Point p = (SharpMap.Geometries.Point)feature.row.Geometry;

                    i++;
                    SceneNode n = point3d(env.getName(), i, (float)p.X, (float)p.Y, 0, nodeIni, env.getSceneMgr());

                    n.SetScale(scale);
                    n.SetPosition(n.Position.x * distanceScale.x, n.Position.y * distanceScale.y, n.Position.z * distanceScale.z);

                    Fragment f = new Fragment(n);
                    output.Add(f);
                }

                //if type of features is Polygon
                else if (feature.row.Geometry is SharpMap.Geometries.Polygon)
                {
                    SharpMap.Geometries.Polygon polygon = (SharpMap.Geometries.Polygon)feature.row.Geometry;

                    ManualObject polygonNode = null;

                    if (polygonNode == null)
                    {
                        polygonNode = env.getSceneMgr().CreateManualObject(env.getName() + "Node_" + i);
                        MaterialPtr material = MaterialManager.Singleton.Create("Test/ColourPolygon",
                                     ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
                        material.GetTechnique(0).GetPass(0).VertexColourTracking =
                                       (int)TrackVertexColourEnum.TVC_AMBIENT;

                        //Vector3 v = Registry.instance().GetEngine("Python").run(Color, feature, null).asVec3();
                        MogreTessellationCallbacks callback = new MogreTessellationCallbacks(polygonNode, Color, feature);

                        if (nameMaterial != null)
                        {
                            callback.Material = nameMaterial; // "Test/ColourPolygon2";
                            callback.MaterialScale = mScale;
                        }

                        GLUtessellatorImpl Glu = (GLUtessellatorImpl)GLUtessellatorImpl.gluNewTess();
                        Glu.gluTessCallback(GLU.GLU_TESS_VERTEX, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_BEGIN, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_END, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_ERROR, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_COMBINE, callback);
                        Glu.gluTessBeginPolygon(null);
                        Glu.gluTessBeginContour();

                        int numVertices = polygon.ExteriorRing.NumPoints/*/10+1*/;
                        int numValores = 3;
                        double[][] data = new double[numVertices][];

                        for (int j = 0; j < numVertices; j++)
                        {
                            data[j] = new double[numValores];
                        }

                        int k = 0;
                        //1 polygon = N vertices
                        foreach (SharpMap.Geometries.Point point in polygon.ExteriorRing.Vertices)
                        {
                            //if (k % 10 == 0)
                            {
                                data[k/*/10*/][0] = point.X;
                                data[k/*/10*/][1] = point.Y;
                                data[k/*/10*/][2] = 0;
                            }
                            k++;

                            //SceneNode n = point3d(env.getName()+i+k, k + 10, (float)point.X * 10.0f, (float)point.Y * 10.0f, 0, nodeIni, env.getSceneMgr());

                        }
                        for (int j = 0; j < data.GetLength(0); j++)
                        {
                            Glu.gluTessVertex(data[j], 0, new Vector3((float)(data[j][1] * distanceScale.y), (float)(data[j][2] * distanceScale.z), (float)(data[j][0] * distanceScale.x)));
                        }

                        Glu.gluTessEndContour();
                        Glu.gluTessNormal(0, 0, 1);
                        Glu.gluTessEndPolygon();

                        nodeIni.AttachObject(polygonNode);

                    }
                    i++;
                }

                //if type of features is MultiPolygon
                else if (feature.row.Geometry is SharpMap.Geometries.MultiPolygon)
                {
                    SharpMap.Geometries.MultiPolygon mp = (SharpMap.Geometries.MultiPolygon)feature.row.Geometry;

                    // 1 MultiPolygon = N polygon
                    foreach (SharpMap.Geometries.Polygon polygon in mp.Polygons)
                    {

                        ManualObject polygonNode = null;

                        if (polygonNode == null)
                        {
                            polygonNode = env.getSceneMgr().CreateManualObject(env.getName() + "Node_" + i);
                            MaterialPtr material = MaterialManager.Singleton.Create("Test/ColourPolygon",
                                     ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
                            material.GetTechnique(0).GetPass(0).VertexColourTracking =
                                           (int)TrackVertexColourEnum.TVC_AMBIENT;

                            //Vector3 v = Registry.instance().GetEngine("Python").run(Color, feature, null).asVec3();
                            MogreTessellationCallbacks callback = new MogreTessellationCallbacks(polygonNode, Color, feature);

                            if (nameMaterial != null)
                            {
                                callback.Material = nameMaterial; // "Test/ColourPolygon2";
                                callback.MaterialScale = mScale;
                            }

                            GLUtessellatorImpl Glu = (GLUtessellatorImpl)GLUtessellatorImpl.gluNewTess();
                            Glu.gluTessCallback(GLU.GLU_TESS_VERTEX, callback);
                            Glu.gluTessCallback(GLU.GLU_TESS_BEGIN, callback);
                            Glu.gluTessCallback(GLU.GLU_TESS_END, callback);
                            Glu.gluTessCallback(GLU.GLU_TESS_ERROR, callback);
                            Glu.gluTessCallback(GLU.GLU_TESS_COMBINE, callback);
                            Glu.gluTessBeginPolygon(null);
                            Glu.gluTessBeginContour();

                            int numVertices = polygon.ExteriorRing.NumPoints;
                            int numValores = 3;
                            double[][] data = new double[numVertices][];

                            for (int j = 0; j < numVertices; j++)
                            {
                                data[j] = new double[numValores];
                            }

                            int k = 0;
                            //1 polygon = N vertices
                            foreach (SharpMap.Geometries.Point point in polygon.ExteriorRing.Vertices)
                            {

                                data[k][0] = point.X;
                                data[k][1] = point.Y;
                                data[k][2] = 0;

                                k++;

                                //SceneNode n = point3d(env.getName(), i, (float)point.X, (float)point.Y, 0, nodeIni, env.getSceneMgr());

                            }
                            for (int j = 0; j < data.GetLength(0); j++)
                            {
                                Glu.gluTessVertex(data[j], 0, new Vector3(((float)data[j][1]) * distanceScale.y, ((float)data[j][2]) * distanceScale.z, ((float)data[j][0]) * distanceScale.x));
                            }

                            Glu.gluTessEndContour();
                            Glu.gluTessNormal(0, 0, 1);
                            Glu.gluTessEndPolygon();

                            nodeIni.AttachObject(polygonNode);

                        }
                        i++;
                    }
                }

                //if type of features is Line
                else if (feature.row.Geometry is SharpMap.Geometries.ILineal/*SharpMap.Geometries.LineString*/)
                {
                    System.Collections.Generic.List<SharpMap.Geometries.ILineal> lineas = new System.Collections.Generic.List<SharpMap.Geometries.ILineal>();
                    if (feature.row.Geometry is SharpMap.Geometries.MultiLineString)
                    {
                        foreach (SharpMap.Geometries.LineString l in ((SharpMap.Geometries.MultiLineString)(feature.row.Geometry)).LineStrings)
                        {
                            lineas.Add(l);
                        }
                    }
                    else
                    {
                        lineas.Add((SharpMap.Geometries.ILineal)(feature.row.Geometry));
                    }
                    foreach (SharpMap.Geometries.ILineal line in lineas)
                    {
                        ManualObject lineNode = env.getSceneMgr().CreateManualObject("line" + i);

                        //MaterialPtr material = MaterialManager.Singleton.Create(nameMaterial,
                        //ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
                        //material.GetTechnique(0).GetPass(0).VertexColourTracking =
                        //               (int)TrackVertexColourEnum.TVC_AMBIENT;
                        //material.GetTechnique(0).GetPass(0).SetDepthBias(100);
                        //material.GetTechnique(0).GetPass(0).LightingEnabled = false;

                        int nSeg = 5; // Number of segments on the cap or join pieces
                        BufferParameters param = new BufferParameters(nSeg, BufferParameters.BufferEndCapStyle.CapRound, BufferParameters.BufferJoinStyle.JoinRound, 2);
                        IGeometryFactory<Coord> geometryFactory = new GeometryFactory<Coord>(new CoordSeqFac(new CoordFac(PrecisionModelType.DoubleFloating)));
                        //IWktGeometryReader<Coord> reader = geometryFactory.WktReader;
                        //string txt = feature.row.Geometry.AsText();
                        ILineString line1 = (ILineString)GeometryConverter.ToNTSGeometry((SharpMap.Geometries.LineString)line, geometryFactory); // (ILineString<Coord>)reader.Read(txt);
                        IGeometry coordBuffer = line1.Buffer(lWidth, param);
                        ICoordinateSequence coords = coordBuffer.Coordinates;
                        //Vector3 v = Registry.instance().GetEngine("Python").run(Color, feature, null).asVec3();
                        MogreTessellationCallbacks callback = new MogreTessellationCallbacks(lineNode, Color, feature);
                        if (nameMaterial != null)
                        {
                            callback.Material = nameMaterial; // "Test/ColourPolygon2";
                            callback.MaterialScale = mScale;
                        }

                        GLUtessellatorImpl Glu = (GLUtessellatorImpl)GLUtessellatorImpl.gluNewTess();
                        Glu.gluTessCallback(GLU.GLU_TESS_VERTEX, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_BEGIN, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_END, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_ERROR, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_COMBINE, callback);
                        Glu.gluTessBeginPolygon(null);
                        Glu.gluTessBeginContour();
                        foreach (Coord coord in coords)
                        {
                            double[] data = new double[] { coord.X * distanceScale.x, coord.Y * distanceScale.y, (double.IsNaN(coord.Z) ? 0 : coord.Z) * distanceScale.z };

                            Glu.gluTessVertex(data, 0, new Vector3((float)data[1], (float)data[2], (float)data[0]));
                        }
                        Glu.gluTessEndContour();
                        Glu.gluTessNormal(0, 0, 1);
                        Glu.gluTessEndPolygon();
                        i++;
                        nodeIni.AttachObject(lineNode);
                    }
                    if ((feature.row.Geometry is SharpMap.Geometries.Polygon) | (feature.row.Geometry is SharpMap.Geometries.MultiPolygon))
                    {
                        Fragment f = new Fragment(nodeIni);
                        output.Add(f);
                    }

                }
            }
            i = 0;//breakpoint

            /*foreach (Fragment fragment in output)
            {
                fragment.Node.Scale(0,0,0);
            }*/

            #if TODO
            // if features are arriving in batch, resolve the color here.
            // otherwise we will resolve it later in process(feature,env).
            is_batch = input.Count > 1;
            batch_feature_color = overall_color;
            if (is_batch && getColorScript() != null)
            {
                ScriptResult r = env.getScriptEngine().run(getColorScript(), env);
                if (r.isValid())
                    batch_feature_color = r.asVec4();
                else
                    env.getReport().error(r.asString());
            }

            return base.process(input, env);
            #endif
            //throw new NotImplementedException();

            if (successor != null)
            {
                if (successor is FeatureFilter)
                {
                    FeatureFilter filter = (FeatureFilter)successor;
                    FeatureList l = filter.process(input, env);
                    //FeatureList l = successor.process(input, env);
                }
                else if (successor is FragmentFilter)
                {
                    FragmentFilter filter = (FragmentFilter)successor;
                    FragmentList l = filter.process(output, env);
                }
            }

            return output;
        }