public ExplorerContentsContainer(ExplorerConfiguration configuration, XmlNode contents_node)
        {
            foreach (XmlNode childNode in contents_node.ChildNodes)
            {
                ExplorerContentBase newItem;
                if (childNode.Name == configuration.getImageTag())
                {
                    newItem = new ExplorerContentImage(configuration, childNode);
                }
                else if (childNode.Name == configuration.getVideoTag())
                {
                    newItem = new ExplorerContentVideo(configuration, childNode);
                }
                else if (childNode.Name == configuration.getTextTag())
                {
                    newItem = new ExplorerContentText(configuration, childNode);
                }
                else if (childNode.Name == configuration.getMapTag())
                {
                    newItem = new ExplorerContentMap(configuration, childNode);
                }
                else
                {
                    throw new ExplorerParseXMLException("Unknown child node: " + childNode.Name, null);
                }

                contentList.Add(newItem.getLocalId(), newItem);
            }
        }
        public LayerBackgroundMap(Canvas parent_canvas, ExplorerContentMap parent_map)
        {
            parentCanvas = parent_canvas;
            parentCanvas.Children.Add(this);

            parentMap = parent_map;
            Image mapImage = parentMap.getImage();

            background = new Canvas();
            background.Background = new ImageBrush(mapImage.Source);
            background.MinWidth = mapImage.Source.Width;
            background.MaxWidth = mapImage.Source.Width;
            background.MinHeight = mapImage.Source.Height;
            background.MaxHeight = mapImage.Source.Height;

            Child = background;
            IsRSTEnabled = true;
            IsRotateEnabled = false; //Prevent rotation since bounds algo doesnt take that into consideration
            IsScaleEnabled = true;
            IsFlickEnabled = false; //Prevent and twitchy behavior
            IsStayInboundsEnabled = false; //Prevent the shifting when zoomed in
            IsMoveToTopOnTouchEnabled = false; //Prevent the layer from coming above other layers

            BehaviorSingleClickHelper clickHelper = new BehaviorSingleClickHelper(parentCanvas);
            clickHelper.OnSingleClick += clickHelper_OnSingleClick;

            Attach(clickHelper);
            Attach(new BehaviorBoundMapToScreen(parent_canvas, mapImage.Source.Width, mapImage.Source.Height));
        }
 public ExplorerRegionsContainer(ExplorerConfiguration configuration, ExplorerContentMap parent_map, XmlNode regions_node)
 {
     parentMap = parent_map;
     foreach (XmlNode childNode in regions_node.ChildNodes)
     {
         if (childNode.Name == configuration.getRegionTag())
         {
             regionList.Add(new ExplorerRegion(configuration, childNode));
         }
     }
 }
        public DraggableBackgroundMap(ExplorerContentMap parent_map)
        {
            parentMap = parent_map;
            Image mapImage = parentMap.getImage();

            parentCanvas = new Canvas();
            parentCanvas.Background = new ImageBrush(mapImage.Source);
            parentCanvas.MinWidth = mapImage.Source.Width;
            parentCanvas.MaxWidth = mapImage.Source.Width;
            parentCanvas.MinHeight = mapImage.Source.Height;
            parentCanvas.MaxHeight = mapImage.Source.Height;

            Child = parentCanvas;
            IsRSTEnabled = false;
            IsRNTEnabled = true;
            IsRotateEnabled = false;
            IsFlickEnabled = false;

            BehaviorSingleClickHelper clickHelper = new BehaviorSingleClickHelper();
            clickHelper.OnSingleClick += clickHelper_OnSingleClick;
            Attach(clickHelper);

            Attach( new BehaviorBoundMapToScreen(mapImage.Source.Width, mapImage.Source.Height));

            foreach(ExplorerRegion region in parent_map.getRegions())
            {
                Console.WriteLine("Adding " + region.getName());
                Polygon regionPolygon = new Polygon();
                foreach(ExplorerPoint point in region.getPoints())
                {
                    regionPolygon.Points.Add(new Point(point.getX() / 2 * ScaleTransform.ScaleX, point.getY() / 2 * ScaleTransform.ScaleY));
                }

                regionPolygon.Fill = new SolidColorBrush(Color.FromArgb(128, 255, 0, 0));
                parentCanvas.Children.Add(regionPolygon);
            }
        }
        public Explorer(String config_name, String file_name)
        {
            configuration = new ExplorerConfiguration(config_name);

            XmlTextReader xmlReader = new XmlTextReader(file_name);
            if (xmlReader.Read())
            {
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(xmlReader);

                if (xmlDoc.ChildNodes.Count == 1 && xmlDoc.ChildNodes.Item(0).Name == configuration.getMapTag())
                {
                    rootMap = new ExplorerContentMap(configuration, xmlDoc.ChildNodes.Item(0));
                }
                else
                {
                    throw new ExplorerLoadXMLException("Multiple Root Tags or Root tag not '" + configuration.getMapTag() + "'", null);
                }
            }
            else
            {
                throw new ExplorerLoadXMLException("XML Document could not be read", null);
            }
        }