コード例 #1
0
 /// <summary>
 /// Gets the polygon points.
 /// </summary>
 /// <returns>a warper for helping handling polygon points or <c>null</c> if this is not a shape that have polygon points.</returns>
 virtual public OoPolygonPointsObserver GetPolygonPointsObserver()
 {
     if (_ppObs == null && PolygonHelper.IsFreeform(Shape))
     {
         _ppObs = new OoPolygonPointsObserver(this);
     }
     return(_ppObs);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PolygonPointSelectedEventArgs"/> class.
 /// </summary>
 /// <param name="ppobs">polygon points observer.</param>
 /// <param name="point">current selected point.</param>
 public PolygonPointSelectedEventArgs(OoPolygonPointsObserver ppobs, tud.mci.tangram.util.PolyPointDescriptor point)
 {
     PolygonPoints = ppobs;
     Point = point;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PolygonPointSelectedEventArgs"/> class with empty Members. 
 /// Should only be used to reset the listeners.
 /// </summary>
 public PolygonPointSelectedEventArgs()
 {
     PolygonPoints = null;
     Point = new util.PolyPointDescriptor();
 }
 private void fire_PolygonPointSelected(OoPolygonPointsObserver ppobs, util.PolyPointDescriptor point)
 {
     if (PolygonPointSelected != null)
     {
         Task t = new Task(new Action(() => { try { PolygonPointSelected.Invoke(this, new PolygonPointSelectedEventArgs(ppobs, point)); } catch { } }));
         t.Start();
     }
 }
        /// <summary>
        /// Gets a compressed textual description for Braille text output for a polygon point.
        /// </summary>
        /// <param name="pointsObs">The points observer.</param>
        /// <returns>a string suitable for short Braille output.</returns>
        public static string GetPointText(OoPolygonPointsObserver pointsObs)
        {
            if (pointsObs != null)
            {
                int index;
                var point = pointsObs.Current(out index);
                if (!point.Equals(default(PolyPointDescriptor)))
                {

                    index += 1;
                    string nodeType = LL.GetTrans("tangram.oomanipulation.element_speaker.label." + point.Flag.ToString());


                    String text = LL.GetTrans("tangram.oomanipulation.element_speaker.text.point",
                        nodeType,
                        index,
                        pointsObs.Count,
                         (((float)point.X / 1000f)).ToString("0.##cm"),
                         (((float)point.Y / 1000f)).ToString("0.##cm")
                        );

                    //point.Flag.ToString() + " (" + index + "/" + pointsObs.Count + ") - x:" + point.X + " y:" + point.Y;

                    return text;
                }
            }
            return String.Empty;
        }
        /// <summary>
        /// Gets an audio description for auditory output for a polygon point.
        /// </summary>
        /// <param name="pointsObs">The points observer.</param>
        /// <returns>a string suitable for auditory output.</returns>
        public static string GetPointAudio(OoPolygonPointsObserver pointsObs)
        {
            if (pointsObs != null)
            {
                int index;
                var point = pointsObs.Current(out index);
                if (!point.Equals(default(PolyPointDescriptor)))
                {

                    index += 1;
                    string nodeType = LL.GetTrans("tangram.oomanipulation.element_speaker.label." + point.Flag.ToString());

                    String audio = LL.GetTrans("tangram.oomanipulation.element_speaker.audio.point",
                        nodeType,
                        index,
                        pointsObs.Count
                        );

                    return audio;
                }
            }
            return String.Empty;
        }
        /// <summary>
        /// Returns the polygon point to audio and textual output receivers.
        /// </summary>
        /// <param name="pointsObs">The points obs.</param>
        public void SpeakPolygonPoint(OoPolygonPointsObserver pointsObs)
        {
            if (pointsObs != null)
            {
                String audio = GetPointAudio(pointsObs);
                String text = GetPointText(pointsObs);

                sentAudioFeedback(audio);
                sentTextFeedback(text);
            }
        }
 /// <summary>
 /// Gets the polygon points.
 /// </summary>
 /// <returns>a warper for helping handling polygon points or <c>null</c> if this is not a shape that have polygon points.</returns>
 public OoPolygonPointsObserver GetPolygonPointsObserver()
 {
     if (_ppObs == null && PolygonHelper.IsFreeform(Shape))
     {
         _ppObs = new OoPolygonPointsObserver(this);
     }
     return _ppObs;
 }